From 34137b599dbea13c94224dff2955376b1394dbc9 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 3 Aug 2013 12:33:39 +0200 Subject: wip --- .../trygvis/container/compiler/ProcessorTest.java | 35 ++-------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java') diff --git a/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java b/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java index e070f3c..2205d52 100644 --- a/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java +++ b/container-compiler-plugin/src/test/java/io/trygvis/container/compiler/ProcessorTest.java @@ -7,10 +7,8 @@ import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; import javax.tools.JavaCompiler; import javax.tools.JavaFileObject; -import javax.tools.SimpleJavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; -import java.net.URI; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Locale; @@ -21,33 +19,6 @@ import static org.fest.assertions.Assertions.assertThat; public class ProcessorTest { Charset UTF_8 = Charset.forName("utf-8"); - /** - * A file object used to represent source coming from a string. - */ - public class JavaSourceFromString extends SimpleJavaFileObject { - /** - * The source code of this "file". - */ - final String code; - - /** - * Constructs a new JavaSourceFromString. - * - * @param name the name of the compilation unit represented by this file object - * @param code the source code for the compilation unit represented by this file object - */ - JavaSourceFromString(String name, String code) { - super(URI.create("string:///" + name.replace('.', '/') + JavaFileObject.Kind.SOURCE.extension), - JavaFileObject.Kind.SOURCE); - this.code = code; - } - - @Override - public CharSequence getCharContent(boolean ignoreEncodingErrors) { - return code; - } - } - @Test public void testBasic() throws Exception { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); @@ -66,6 +37,9 @@ public class ProcessorTest { Boolean result = task.call(); + assertThat(fileManager.codes.keySet()).containsOnly("Person_Sql"); + System.out.println(fileManager.codes.get("Person_Sql")); + for (Diagnostic diagnostic : collector.getDiagnostics()) { // System.out.println("diagnostic = " + diagnostic); System.out.println("diagnostic.source = ->" + diagnostic.getSource().getName() + "<-"); @@ -76,8 +50,5 @@ public class ProcessorTest { assertThat(result).isTrue(); fileManager.close(); - - assertThat(fileManager.codes.keySet()).containsOnly("Person_Sql"); - System.out.println(fileManager.codes.get("Person_Sql")); } } -- cgit v1.2.3