Package juzu.impl.compiler

Examples of juzu.impl.compiler.CompilationError


  public void testBundleNotFound() throws Exception {
    CompilerAssert<File, File> compilerAssert = compiler("examples.app2");
    compilerAssert.formalErrorReporting();                                     //<1>
    List<CompilationError> errors = compilerAssert.failCompile();              //<2>
    assertEquals(1, errors.size());                                            //<3>
    CompilationError error = errors.get(0);
    assertEquals(BundleGenMetaModelPlugin.BUNDLE_NOT_FOUND, error.getCode())//<4>
    assertEquals(Collections.singletonList("mybundle"), error.getArguments());
    File source = error.getSourceFile();
    assertEquals("package-info.java", source.getName());
    assertEquals("app2", source.getParentFile().getName());
  }
View Full Code Here


    JavaFile file = helper.assertJavaSource("metamodel.controller.A");
    ClassOrInterfaceDeclaration a = file.assertDeclaration();
    a.setModifiers(a.getModifiers() | Modifier.ABSTRACT);
    file.assertSave();
    List<CompilationError> errors = helper.failCompile();
    CompilationError error = errors.get(0);
    assertEquals(ControllerMetaModel.CONTROLLER_IS_ABSTRACT, error.getCode());
    assertTrue("Was expecting " + error.getSource() + " to end with A.java", error.getSource().endsWith("A.java"));
  }
View Full Code Here

  public void testCompile() throws Exception {
    CompilerAssert<?, ?> app  = compiler("plugin.asset.duplicateid");
    app.formalErrorReporting();
    List<CompilationError> errors = app.failCompile();
    assertEquals(1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals(AssetMetaModelPlugin.DUPLICATE_ASSET_ID, error.getCode());
    assertEquals(Arrays.asList("test"), error.getArguments());
  }
View Full Code Here

  public void testControllerNotFound() throws Exception {
    CompilerAssert<File, File> compiler = compiler("plugin.template.controllernotfound");
    compiler.formalErrorReporting(true);
    List<CompilationError> errors = compiler.failCompile();
    assertEquals(1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals(TemplateMetaModel.CONTROLLER_NOT_RESOLVED, error.getCode());
    assertEquals(Arrays.asList("Foo.bar({})", "/plugin/template/controllernotfound/templates/index.gtmpl", "2", "4"), error.getArguments());
  }
View Full Code Here

//  @Test
  public void testInvalidMethodName() throws Exception {
    CompilerAssert<?, ?> compiler = compiler("plugin.template.url.invalid_method_name");
    List<CompilationError> errors = compiler.failCompile();
    assertEquals("Was expecting 1 error instead of " + errors, 1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals("/plugin/template/url/invalid_method_name/A.java", error.getSource());
  }
View Full Code Here

//  @Test
  public void testInvalidMethodArgs() throws Exception {
    CompilerAssert<?, ?> compiler = compiler("plugin.template.url.invalid_method_args");
    List<CompilationError> errors = compiler.failCompile();
    assertEquals("Was expecting 1 error instead of " + errors, 1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals("/plugin/template/url/invalid_method_args/A.java", error.getSource());
  }
View Full Code Here

  public void testNoPublicCtor() throws Exception {
    CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.nopublicctor");
    compiler.formalErrorReporting(true);
    List<CompilationError> errors = compiler.failCompile();
    assertEquals(1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals(BindingMetaModelPlugin.PROVIDER_FACTORY_NO_PUBLIC_CTOR, error.getCode());
    File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "nopublicctor", "package-info.java");
    assertEquals(f, error.getSourceFile());
  }
View Full Code Here

  public void testNoZeroCtor() throws Exception {
    CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.nozeroargctor");
    compiler.formalErrorReporting(true);
    List<CompilationError> errors = compiler.failCompile();
    assertEquals(1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals(BindingMetaModelPlugin.PROVIDER_FACTORY_NO_ZERO_ARG_CTOR, error.getCode());
    File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "nozeroargctor", "package-info.java");
    assertEquals(f, error.getSourceFile());
  }
View Full Code Here

  public void testAbstractClass() throws Exception {
    CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.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());
    File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "abstractclass", "package-info.java");
    assertEquals(f, error.getSourceFile());
  }
View Full Code Here

  public void testNotPublicClass() throws Exception {
    CompilerAssert<File, File> compiler = compiler("plugin.binding.provider.factory.notpublicclass");
    compiler.formalErrorReporting(true);
    List<CompilationError> errors = compiler.failCompile();
    assertEquals(1, errors.size());
    CompilationError error = errors.get(0);
    assertEquals(BindingMetaModelPlugin.PROVIDER_FACTORY_NOT_PUBLIC, error.getCode());
    File f = compiler.getSourcePath().getPath("plugin", "binding", "provider", "factory", "notpublicclass", "package-info.java");
    assertEquals(f, error.getSourceFile());
  }
View Full Code Here

TOP

Related Classes of juzu.impl.compiler.CompilationError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.