From df92538ab3d83da9839f08b28fc8a67317565463 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 3 Aug 2013 20:21:19 +0200 Subject: wip --- .../trygvis/container/compiler/ProcessorTest.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 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 bac8209..b8d022d 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 @@ -38,21 +38,27 @@ public class ProcessorTest { task.setProcessors(asList(new MyProcessor())); - Boolean result = task.call(); + boolean result = task.call(); + if (!result) { + for (Diagnostic diagnostic : collector.getDiagnostics()) { + JavaFileObject source = diagnostic.getSource(); + String error = ""; + if (source != null) { + error += source.toUri().getPath(); + } + error += ":" + diagnostic.getLineNumber() + ":" + diagnostic.getColumnNumber(); + System.out.println(error + ":" + diagnostic.getMessage(Locale.ENGLISH)); + } + } - assertThat(fileManager.codes.keySet()).containsOnly( - "io.trygvis.persistence.test.Daos", - "io.trygvis.persistence.test.PersonDao"); for (Map.Entry entry : fileManager.codes.entrySet()) { System.out.println("=== " + entry.getKey()); System.out.println(entry.getValue()); } - for (Diagnostic diagnostic : collector.getDiagnostics()) { - System.out.println("diagnostic.source = ->" + diagnostic.getSource().getName() + "<-"); - System.out.println("diagnostic.message = " + diagnostic.getMessage(Locale.ENGLISH)); - } - + assertThat(fileManager.codes.keySet()).containsOnly( + "io.trygvis.persistence.test.Session", + "io.trygvis.persistence.test.PersonDao"); assertThat(collector.getDiagnostics()).isEmpty(); assertThat(result).isTrue(); @@ -62,7 +68,7 @@ public class ProcessorTest { private JavaSourceFromString loadCode(String className) throws IOException { String path = "/" + className.replace('.', '/') + ".java"; URL resource = getClass().getResource(path); - if(resource == null) { + if (resource == null) { throw new RuntimeException("Could not load code for: " + path); } return new JavaSourceFromString(className, IOUtils.toString(resource, UTF_8)); -- cgit v1.2.3