use of org.jbehave.core.io.LoadFromClasspath in project jbehave-core by jbehave.
the class ParameterConvertersBehaviour method shouldConvertSinglelineTableToParameters.
@Test
public void shouldConvertSinglelineTableToParameters() {
ParameterConverter converter = new ExamplesTableParametersConverter(new ExamplesTableFactory(new LoadFromClasspath(), new TableTransformers()));
Type type = MyParameters.class;
assertThatTypesAreAccepted(converter, type);
String value = "|col1|col2|\n|row11|row12|\n";
MyParameters parameters = (MyParameters) converter.convertValue(value, type);
assertThat(parameters.col1, is("row11"));
assertThat(parameters.col2, is("row12"));
}
use of org.jbehave.core.io.LoadFromClasspath in project jbehave-core by jbehave.
the class ParameterConvertersBehaviour method shouldConvertToSortedSetOfCustomObjectsUsingCustomConverter.
@SuppressWarnings("unchecked")
@Test
public void shouldConvertToSortedSetOfCustomObjectsUsingCustomConverter() {
ParameterConverters parameterConverters = new ParameterConverters(new LoadFromClasspath());
parameterConverters.addConverters(new FooToBarParameterConverter());
Type type = new TypeLiteral<SortedSet<Bar>>() {
}.getType();
Set<Bar> set = (Set<Bar>) parameterConverters.convert("foo", type);
assertThatCollectionIs(set, Bar.INSTANCE);
}
use of org.jbehave.core.io.LoadFromClasspath in project jbehave-core by jbehave.
the class ChainedRowBehaviour method shouldChainRowValuesWithoutOverwritingAlreadyExisting.
@Test
public void shouldChainRowValuesWithoutOverwritingAlreadyExisting() throws Exception {
Map<String, String> map1 = new HashMap<>();
map1.put("one", "11");
Map<String, String> map2 = new HashMap<>();
map2.put("one", "21");
map2.put("two", "22");
ParameterConverters parameterConverters = new ParameterConverters(new LoadFromClasspath(), new TableTransformers());
Map<String, String> chainedValues = new ChainedRow(new ConvertedParameters(map1, parameterConverters), new ConvertedParameters(map2, parameterConverters)).values();
assertThat(chainedValues.get("one"), equalTo("11"));
assertThat(chainedValues.get("two"), equalTo("22"));
}
use of org.jbehave.core.io.LoadFromClasspath in project jbehave-core by jbehave.
the class OdtLoaderBehaviour method shouldLoadOdtResourceFromClasspath.
@Test
public void shouldLoadOdtResourceFromClasspath() {
String resourceFromOdtWithTable = new LoadOdtFromClasspath(this.getClass()).loadResourceAsText("org/jbehave/core/io/odf/stories/a_story.odt");
String resourceFromTxt = new LoadFromClasspath(this.getClass()).loadResourceAsText("org/jbehave/core/io/odf/stories/a_story.txt");
assertThatOutputIs(resourceFromOdtWithTable.trim(), resourceFromTxt.trim());
}
Aggregations