From 41704c6a57d53b90b4e764ea4fb9c8ff81ced500 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 11 Aug 2013 11:15:56 +0200 Subject: o Fixing a couple of test failures. --- .../java/io/trygvis/container/compiler/model/TypeRef.java | 10 +++++----- .../java/io/trygvis/container/compiler/ProcessorTest.java | 8 +++++--- .../test/java/io/trygvis/persistence/EntityMirrorTest.java | 14 +++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java b/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java index c329ab3..d359029 100644 --- a/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java +++ b/container-compiler-plugin/src/main/java/io/trygvis/container/compiler/model/TypeRef.java @@ -82,10 +82,6 @@ public class TypeRef implements Comparable { this(fqName, name, false, array, args); } - public TypeRef args(List args) { - return new TypeRef(fqName, plainName, primitive, array, args); - } - public boolean isPrimitive() { return primitive; } @@ -108,10 +104,14 @@ public class TypeRef implements Comparable { return fqName; } + public TypeRef args(List args) { + return new TypeRef(fqName, plainName, primitive, array, args); + } + public TypeRef args(TypeRef... args) { List list = new ArrayList<>(); for (TypeRef arg : args) { - list.add(arg.plainName); + list.add(arg.toString()); } return args(list); } 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 ed894c5..f8cecac 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 @@ -62,10 +62,12 @@ public class ProcessorTest { assertThat(fileManager.codes.keySet()).containsOnly( "io.trygvis.persistence.test.Sequences", - "io.trygvis.persistence.test.TestEntityManager", - "io.trygvis.persistence.test.TestEntityManagerFactory", + "io.trygvis.persistence.test.TestSqlSession", + "io.trygvis.persistence.test.TestSqlSessionFactory", "io.trygvis.persistence.test.PersonDao", - "io.trygvis.persistence.test.ChildEntityDao"); + "io.trygvis.persistence.test.PersonRow", + "io.trygvis.persistence.test.ChildEntityDao", + "io.trygvis.persistence.test.ChildEntityRow"); assertThat(collector.getDiagnostics()).isEmpty(); assertThat(result).isTrue(); diff --git a/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java b/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java index dc69a03..fc63a8a 100644 --- a/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java +++ b/container-compiler-plugin/src/test/java/io/trygvis/persistence/EntityMirrorTest.java @@ -95,7 +95,7 @@ public class EntityMirrorTest { public static Object[][] insertIntoMethodProvider() { return new Object[][]{ new Object[]{new FieldMirror[]{name}, join( - "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", + "try (java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", " java.lang.String name = o.name;", " if (name == null) {", " stmt.setNull(1, java.sql.Types.VARCHAR);", @@ -106,13 +106,13 @@ public class EntityMirrorTest { "}") }, new Object[]{new FieldMirror[]{year}, join( - "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", + "try (java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", " stmt.setInt(1, o.getYear());", " stmt.executeUpdate();", "}") }, new Object[]{new FieldMirror[]{age, year, idLong}, join( - "try(java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", + "try (java.sql.PreparedStatement stmt = con.prepareStatement(insertIntoSql)) {", " stmt.setInt(1, o.age);", " stmt.setInt(2, o.getYear());", " stmt.executeUpdate();", @@ -137,10 +137,10 @@ public class EntityMirrorTest { public static Object[][] deleteMethodProvider() { return new Object[][]{ new Object[]{new FieldMirror[]{idLong}, join( - "deleteById(con, o.id);") + "deleteWatById(con, o.id);") }, new Object[]{new FieldMirror[]{idMethod}, join( - "deleteById(con, o.getId());") + "deleteWatById(con, o.getId());") }, }; } @@ -161,13 +161,13 @@ public class EntityMirrorTest { public static Object[][] deleteByIdMethodProvider() { return new Object[][]{ new Object[]{new FieldMirror[]{idLong}, join( - "try(java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {", + "try (java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {", " stmt.setLong(1, id);", " stmt.executeUpdate();", "}") }, new Object[]{new FieldMirror[]{idMethod}, join( - "try(java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {", + "try (java.sql.PreparedStatement stmt = con.prepareStatement(deleteFromSql)) {", " stmt.setLong(1, id);", " stmt.executeUpdate();", "}") -- cgit v1.2.3