Java 类org.eclipse.xtext.testing.serializer.SerializerTestHelper 实例源码

项目:xtext-extras    文件:AbstractXtextTests.java   
public final XtextResource getResourceAndExpect(InputStream in, URI uri, int expectedErrors) throws Exception {
    XtextResource resource = doGetResource(in, uri);
    checkNodeModel(resource);
    if (expectedErrors != UNKNOWN_EXPECTATION) {
        if (expectedErrors == EXPECT_ERRORS)
            assertFalse(Joiner.on('\n').join(resource.getErrors()), resource.getErrors().isEmpty());
        else
            assertEquals(Joiner.on('\n').join(resource.getErrors()), expectedErrors, resource.getErrors().size());
    }
    for(Diagnostic d: resource.getErrors()) {
        if (d instanceof ExceptionDiagnostic)
            fail(d.getMessage());
    }
    if (expectedErrors == 0 && resource.getContents().size() > 0 && shouldTestSerializer(resource)) {
        SerializerTestHelper tester = get(SerializerTestHelper.class);
        EObject obj = resource.getContents().get(0);
        tester.assertSerializeWithNodeModel(obj);
        tester.assertSerializeWithoutNodeModel(obj);
    }
    return resource;
}
项目:xtext-core    文件:AbstractXtextTests.java   
public final XtextResource getResourceAndExpect(InputStream in, URI uri, int expectedErrors) throws Exception {
    XtextResource resource = doGetResource(in, uri);
    checkNodeModel(resource);
    if (expectedErrors != UNKNOWN_EXPECTATION) {
        if (expectedErrors == EXPECT_ERRORS)
            assertFalse(Joiner.on('\n').join(resource.getErrors()), resource.getErrors().isEmpty());
        else
            assertEquals(Joiner.on('\n').join(resource.getErrors()), expectedErrors, resource.getErrors().size());
    }
    for(Diagnostic d: resource.getErrors()) {
        if (d instanceof ExceptionDiagnostic)
            fail(d.getMessage());
    }
    if (expectedErrors == 0 && resource.getContents().size() > 0 && shouldTestSerializer(resource)) {
        SerializerTestHelper tester = get(SerializerTestHelper.class);
        EObject obj = resource.getContents().get(0);
        tester.assertSerializeWithNodeModel(obj);
        tester.assertSerializeWithoutNodeModel(obj);
    }
    return resource;
}
项目:n4js    文件:PositiveAnalyser.java   
/***/
// TODO after java update bring back null analysis
// public PositiveAnalyser(final @Nonnull Logger logger) {
public PositiveAnalyser(final Logger logger, SerializerTestHelper serializerTester) {
    super(logger);
    this.serializerTester = serializerTester;
}