类org.junit.rules.ErrorCollector源码实例Demo

下面列出了怎么用org.junit.rules.ErrorCollector的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: components   文件: ComponentTestUtils.java
/**
 * check all properties of a component for i18n, check form i18n, check ComponentProperties title is i18n
 * 
 * @param componentService where to get all the components
 * @param errorCollector used to collect all errors at once. @see
 *            <a href="http://junit.org/apidocs/org/junit/rules/ErrorCollector.html">ErrorCollector</a>
 * @deprecated use {@link PropertiesTestUtils#assertAlli18nAreSetup(DefinitionRegistryService, ErrorCollector)} and
 *             {@link #assertReturnProperties18nAreSet(DefinitionRegistryService, ErrorCollector)}
 */
@Deprecated
static public void testAlli18n(ComponentService componentService, ErrorCollector errorCollector) {
    Set<ComponentDefinition> allComponents = componentService.getAllComponents();
    for (ComponentDefinition cd : allComponents) {
        ComponentProperties props = (ComponentProperties) PropertiesImpl.createNewInstance(cd.getPropertiesClass(), "root")
                .init();
        // check all properties
        if (props != null) {
            checkAllI18N(props, errorCollector);
        } else {
            System.out.println("No properties to check fo I18n for :" + cd.getName());
        }
        // check component definition title
        errorCollector.checkThat(
                "missing I18n property [" + cd.getTitle() + "] for definition [" + cd.getClass().getName() + "]",
                cd.getTitle().contains("component."), is(false));
        // check return properties i18n
        checkAllPropertyI18n(cd.getReturnProperties(), cd, errorCollector);
    }
}
 
源代码2 项目: beam   文件: FakeWindmillServer.java
public FakeWindmillServer(ErrorCollector errorCollector) {
  workToOffer = new ConcurrentLinkedQueue<>();
  dataToOffer = new ConcurrentLinkedQueue<>();
  commitsReceived = new ConcurrentHashMap<>();
  exceptions = new LinkedBlockingQueue<>();
  expectedExceptionCount = new AtomicInteger();
  this.errorCollector = errorCollector;
  statsReceived = new ArrayList<>();
  droppedStreamingCommits = new AtomicInteger();
}
 
源代码3 项目: components   文件: CommonTestUtils.java
static public void checkAllSchemaPathAreSchemaTypes(ComponentService service, ErrorCollector collector) {
    Set<ComponentDefinition> allComponents = service.getAllComponents();
    for (ComponentDefinition cd : allComponents) {
        ComponentProperties properties = cd.createProperties();
        if (properties instanceof FixedConnectorsComponentProperties) {
            checkAllSchemaPathAreSchemaTypes((FixedConnectorsComponentProperties) properties, collector);
        }
    }
}
 
源代码4 项目: components   文件: CommonTestUtils.java
private static void checkAllConnector(FixedConnectorsComponentProperties fccp, ErrorCollector collector,
        Set<PropertyPathConnector> allConnectors) {
    for (PropertyPathConnector connector : allConnectors) {
        NamedThing property = fccp.getProperty(connector.getPropertyPath());
        collector.checkThat(property, notNullValue());
        collector.checkThat(property, anyOf(instanceOf(Property.class), instanceOf(SchemaProperties.class)));
    }
}
 
源代码5 项目: components   文件: ComponentTestUtils.java
/**
 * check all properties of a component for i18n, check form i18n, check ComponentProperties title is i18n
 * 
 * @param componentService where to get all the components
 * @param errorCollector used to collect all errors at once. @see
 *            <a href="http://junit.org/apidocs/org/junit/rules/ErrorCollector.html">ErrorCollector</a>
 */
static public void assertReturnProperties18nAreSet(DefinitionRegistryService definitionRegistry,
        ErrorCollector errorCollector) {
    Collection<ComponentDefinition> allComponents = definitionRegistry.getDefinitionsMapByType(ComponentDefinition.class)
            .values();
    for (ComponentDefinition cd : allComponents) {
        // check return properties i18n
        checkAllPropertyI18n(cd.getReturnProperties(), cd, errorCollector);
    }
}
 
源代码6 项目: components   文件: ComponentTestUtils.java
public static void checkAllPropertyI18n(Property<?>[] propertyArray, Object parent, ErrorCollector errorCollector) {
    if (propertyArray != null) {
        for (Property<?> prop : propertyArray) {
            PropertiesTestUtils.chekProperty(errorCollector, prop, parent);
        }
    } // else no property to check so ignore.
}
 
源代码7 项目: pinpoint   文件: TraceMetadataVerifier.java
void verifyAnnotationKeys(ErrorCollector collector) {
    collector.checkThat("No annotation keys registered.", traceMetadataSetupContext.dynamicAnnotationKeys, is(not(empty())));
    for (Map.Entry<Integer, List<String>> e : annotationKeyNamesByCode.entrySet()) {
        Integer annotationKeyCode = e.getKey();
        List<String> annotationKeyNames = e.getValue();
        collector.checkThat("Duplicate annotation keys. Code : " + annotationKeyCode + ", names : " + annotationKeyNames,
                annotationKeyNames, hasSize(1));
    }
}
 
@Async
public void getStringInFuture(ErrorCollector collector) {
	final String backendValue = traceeBackend.get("myKey");
	collector.checkThat(backendValue, notNullValue());
	collector.checkThat(oldVals, not(hasItem(backendValue)));
	oldVals.add(backendValue);
	invocationCount.incrementAndGet();
}
 
源代码9 项目: components   文件: CommonTestUtils.java
static public void checkAllSchemaPathAreSchemaTypes(FixedConnectorsComponentProperties fccp, ErrorCollector collector) {
    Set<PropertyPathConnector> allConnectors = fccp.getAllSchemaPropertiesConnectors(true);
    checkAllConnector(fccp, collector, allConnectors);
    allConnectors = fccp.getAllSchemaPropertiesConnectors(false);
    checkAllConnector(fccp, collector, allConnectors);
}
 
源代码10 项目: components   文件: ComponentTestUtils.java
public static Properties checkSerialize(Properties props, ErrorCollector errorCollector) {
    return PropertiesTestUtils.checkSerialize(props, errorCollector);
}
 
源代码11 项目: components   文件: ComponentTestUtils.java
static public void checkAllI18N(Properties checkedProps, ErrorCollector errorCollector) {
    PropertiesTestUtils.checkAllI18N(checkedProps, errorCollector);
}