@Test
public void testCompileError() throws Exception {

  ClassLoader classLoader = this.getClass().getClassLoader();
  DiagnositicsLogger diagnosticsLogger = new DiagnositicsLogger();
  DynamicCompiler compiler = new DynamicCompiler(classLoader, diagnosticsLogger);
  String src = "package com.joliciel.talismane.utils.compiler.foo;\n" + "import com.joliciel.talismane.utils.compiler.DynamicCompilerTest.HelloInterface;\n"
      + "public class Foo implements HelloInterface {\n" + "        public String hello(String who) {\n" + "            return \"Hello \" + who\n"
      + "        }\n" + "    }";
  String fullName = "com.joliciel.talismane.utils.compiler.foo.Foo";
  try {
    compiler.compile(fullName, src, null);
    fail("Expected exception");
  } catch (DynamicCompilerException e) {
    LOG.debug(e.getMessage());
  }
  Diagnostic<? extends JavaFileObject> diagnostic = diagnosticsLogger.getDiagnostics().get(0);
  assertEquals(5, diagnostic.getLineNumber());
  assertEquals("compiler.err.expected", diagnostic.getCode());
  assertEquals("Foo.java", diagnostic.getSource().getName());
}