@Test public void testAbstractClass() throws Exception { CompilerAssert<?, ?> compiler = compiler("plugin", "binding", "provider", "abstractclass"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.IMPLEMENTATION_NOT_ABSTRACT, error.getCode()); assertEquals("/plugin/binding/provider/abstractclass/package-info.java", error.getSource()); }
@Test public void testNotAssignable() throws Exception { CompilerAssert<?, ?> compiler = compiler("plugin", "binding", "provider", "notassignable"); compiler.formalErrorReporting(true); List<CompilationError> errors = compiler.failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(BindingMetaModelPlugin.PROVIDER_NOT_ASSIGNABLE, error.getCode()); assertEquals("/plugin/binding/provider/notassignable/package-info.java", error.getSource()); }
@Test public void testNotFound() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.notfound"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.GENERAL_PROBLEM, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "notfound", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "notfound", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testMalformedPath() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.malformedpath"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.MALFORMED_PATH, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "malformedpath", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput() .getPath("plugin", "less4j", "malformedpath", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testCannotResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.cannotresolve"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "cannotresolve", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput() .getPath("plugin", "less4j", "cannotresolve", "assets", "stylesheet.css"); assertNull(f); }