本文整理了Java中cucumber.api.DataTable.topCells()
方法的一些代码示例,展示了DataTable.topCells()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataTable.topCells()
方法的具体详情如下:
包路径:cucumber.api.DataTable
类名称:DataTable
方法名:topCells
暂无
代码示例来源:origin: com.foreach.cwb/cwb-core
@Then("^ensure that \"([^\"]*)\" (?:contains|should contain):$")
public void ensure_that_contains( String spelExpressionOne, DataTable dataTable ) throws Throwable {
Object entity = spel.getValue( spelExpressionOne );
int numberOfCells = dataTable.topCells().size();
if ( numberOfCells != 1 && numberOfCells != 2 ) {
fail( "should not contain only supports tables of 1 or 2 columns" );
}
Map<String, String> values = new HashMap<String, String>();
if ( numberOfCells == 1 ) {
List<String> datatablecells = dataTable.asList( String.class );
for ( String cell : datatablecells ) {
values.put( cell, null );
}
}
if ( numberOfCells == 2 ) {
values = dataTable.asMap( String.class, String.class );
}
Map entities = new BeanMap( entity );
mapChecker.contains( entities, values, true );
}
代码示例来源:origin: Appendium/objectlabkit
public static <T> void compareResults(final Class<T> classType, final List<T> actual, final DataTable expected) {
final List<String> fieldsToCompare = expected.topCells();
final T[] expectedEntities = convertDataTableToExpected(classType, expected, fieldsToCompare);
final List<T> actualEntities = actual.stream().map(sea -> copyFieldValues(fieldsToCompare, sea, classType)).collect(Collectors.toList());
try {
assertThat(actualEntities).usingElementComparator(comparator(buildExclusionFields(classType, fieldsToCompare)))
.containsOnly(expectedEntities);
} catch (final java.lang.AssertionError e) {
final String actualDataAsStr = convertToString(actual, fieldsToCompare);
throw new ComparisonFailure("Table comparison for " + classType.getSimpleName() + " does not match\n", expected.toString(),
actualDataAsStr);
}
}
内容来源于网络,如有侵权,请联系作者删除!