@Test
public void testCompileTwoClasses() throws Exception {

  ClassLoader classLoader = this.getClass().getClassLoader();
  DiagnositicsLogger diagnosticsLogger = new DiagnositicsLogger();
  DynamicCompiler compiler = new DynamicCompiler(classLoader, diagnosticsLogger);
  String src1 = "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 name1 = "com.joliciel.talismane.utils.compiler.foo.Foo";
  String src2 = "package com.joliciel.talismane.utils.compiler.foo;\n" + "import com.joliciel.talismane.utils.compiler.DynamicCompilerTest.HelloInterface;\n"
      + "public class Bar implements HelloInterface {\n" + "        public String hello(String who) {\n" + "     Foo foo = new Foo();\n"
      + "           return foo.hello(who) + \"!\";\n" + "        }\n" + "    }";
  String name2 = "com.joliciel.talismane.utils.compiler.foo.Bar";
  Map<String, CharSequence> sources = new LinkedHashMap<String, CharSequence>();
  sources.put(name1, src1);
  sources.put(name2, src2);
  Map<String, Class<?>> classes = compiler.compileMany(sources, null);
  @SuppressWarnings("unchecked")
  Class<HelloInterface> helloClass = (Class<HelloInterface>) classes.get(name2);
  HelloInterface bar = helloClass.newInstance();
  assertEquals("Hello world!", bar.hello("world"));
}