org.hamcrest.Matchers#describedAs ( )源码实例Demo

下面列出了org.hamcrest.Matchers#describedAs ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: morf   文件: TestDatabaseMetaDataProvider.java
private static Matcher<? super Table> tableNameMatcher(String tableName) {
  Matcher<Table> subMatchers = Matchers.allOf(ImmutableList.of(
    propertyMatcher(Table::getName, "name", tableNameEqualTo(tableName))
  ));

  return Matchers.describedAs("%0", subMatchers, tableName);
}
 
源代码2 项目: morf   文件: TestDatabaseMetaDataProvider.java
private static Matcher<? super View> viewNameMatcher(String viewName) {
  Matcher<View> subMatchers = Matchers.allOf(ImmutableList.of(
    propertyMatcher(View::getName, "name", viewNameEqualTo(viewName))
  ));

  return Matchers.describedAs("%0", subMatchers, viewName);
}
 
源代码3 项目: morf   文件: TestDatabaseMetaDataProvider.java
private static Matcher<? super Column> columnMatcher(Column column) {
  Matcher<Column> subMatchers = Matchers.allOf(ImmutableList.of(
    propertyMatcher(Column::getName, "name", columnNameEqualTo(column.getName())),
    propertyMatcher(Column::getType, "type", equalTo(column.getType())),
    propertyMatcher(Column::getWidth, "width", equalTo(column.getWidth())),
    propertyMatcher(Column::getScale, "scale", equalTo(column.getScale())),
    propertyMatcher(Column::isNullable, "null", equalTo(column.isNullable())),
    propertyMatcher(Column::isPrimaryKey, "PK", equalTo(column.isPrimaryKey())),
    propertyMatcher(Column::getDefaultValue, "default", equalTo(column.getDefaultValue())),
    propertyMatcher(Column::isAutoNumbered, "autonum", equalTo(column.isAutoNumbered())),
    propertyMatcher(Column::getAutoNumberStart, "from", equalTo(column.getAutoNumberStart()))
  ));

  return Matchers.describedAs("%0", subMatchers, column.toString());
}
 
源代码4 项目: morf   文件: TestDatabaseMetaDataProvider.java
private static Matcher<? super Index> indexMatcher(Index index) {
  Matcher<Index> subMatchers = Matchers.allOf(ImmutableList.of(
    propertyMatcher(Index::getName, "name", indexNameEqualTo(index.getName())),
    propertyMatcher(Index::columnNames, "columns", contains(indexColumnNamesEqualTo(index.columnNames()))),
    propertyMatcher(Index::isUnique, "unique", equalTo(index.isUnique()))
  ));

  return Matchers.describedAs("%0", subMatchers, index.toString());
}
 
源代码5 项目: monsoon   文件: JsonUtil.java
public static Matcher<Iterable<? extends TimeSeriesCollection>> createOrderingExceptation(Collection<? extends TimeSeriesCollection> c) {
    return Matchers.describedAs("is ordered by timestamp",
            Matchers.contains(c.stream()
                    .map(TimeSeriesCollection::getTimestamp)
                    .sorted()
                    .map(ts -> Matchers.hasProperty("timestamp", Matchers.equalTo(ts)))
                    .collect(Collectors.toList())));
}