use of org.jbehave.core.model.ExamplesTable in project jbehave-core by jbehave.
the class ParameterConvertersBehaviour method shouldConvertParameterFromMethodReturningValue.
@Test
public void shouldConvertParameterFromMethodReturningValue() throws IntrospectionException {
Method method = SomeSteps.methodFor("aMethodReturningExamplesTable");
ParameterConverter converter = new MethodReturningConverter(method, new SomeSteps());
assertThatTypesAreAccepted(converter, method.getReturnType());
String value = "|col1|col2|\n|row11|row12|\n|row21|row22|\n";
ExamplesTable table = (ExamplesTable) converter.convertValue(value, ExamplesTable.class);
assertThat(table.getRowCount(), is(2));
Map<String, String> row1 = table.getRow(0);
assertThat(row1.get("col1"), is("row11"));
assertThat(row1.get("col2"), is("row12"));
Map<String, String> row2 = table.getRow(1);
assertThat(row2.get("col1"), is("row21"));
assertThat(row2.get("col2"), is("row22"));
}
use of org.jbehave.core.model.ExamplesTable in project jbehave-core by jbehave.
the class GuiceAnnotationBuilderBehaviour method assertThatExamplesTableIsConverted.
private void assertThatExamplesTableIsConverted(ParameterConverters parameterConverters) {
String tableAsString = "||one||two||\n" + "|1|2|";
ExamplesTable table = new ExamplesTable(tableAsString);
assertThat(table.getHeaders(), hasItems("one", "two"));
}
use of org.jbehave.core.model.ExamplesTable in project jbehave-core by jbehave.
the class NeedleAnnotationBuilderBehaviour method assertThatExamplesTableIsConverted.
private void assertThatExamplesTableIsConverted(final ParameterConverters parameterConverters) {
final String tableAsString = "||one||two||\n" + "|1|2|";
final ExamplesTable table = new ExamplesTable(tableAsString);
assertThat(table.getHeaders(), hasItems("one", "two"));
}
Aggregations