diff --git a/src/main/resources/org/fulib/templates/tables/members.stg b/src/main/resources/org/fulib/templates/tables/members.stg index 7a2ba7b7..f63953c8 100644 --- a/src/main/resources/org/fulib/templates/tables/members.stg +++ b/src/main/resources/org/fulib/templates/tables/members.stg @@ -169,18 +169,24 @@ tableToString(clazz) ::= << StringBuilder buf = new StringBuilder(); for (String key : this.columnMap.keySet()) { - buf.append(key).append(" \t"); + buf.append("| ").append(key).append(" \t"); } - buf.append("\n"); + buf.append("|\n"); + + for (String ignored : this.columnMap.keySet()) + { + buf.append("| --- "); + } + buf.append("|\n"); + for (List\ row : this.table) { for (Object cell : row) { - buf.append(cell).append(" \t"); + buf.append("| ").append(cell).append(" \t"); } - buf.append("\n"); + buf.append("|\n"); } - buf.append("\n"); return buf.toString(); } >> diff --git a/src/test/java/org/fulib/generator/TablesTest.java b/src/test/java/org/fulib/generator/TablesTest.java index 969b994f..e8d4d41f 100644 --- a/src/test/java/org/fulib/generator/TablesTest.java +++ b/src/test/java/org/fulib/generator/TablesTest.java @@ -256,8 +256,8 @@ private void runTableTests(ClassLoader classLoader, String packageName) throws E }; assignmentsFilterRow.invoke(assignmentsTable, rowPredicate); - assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \twa1337 Math \tintegrals"))); - assertThat(assignmentsTable.toString(), containsString("Alice m4242 \twa1337 Math \tmatrices")); + assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \t| wa1337 Math \t| integrals"))); + assertThat(assignmentsTable.toString(), containsString("Alice m4242 \t| wa1337 Math \t| matrices")); // has done uniTable = declaredConstructors.newInstance(uniArray); @@ -266,8 +266,8 @@ private void runTableTests(ClassLoader classLoader, String packageName) throws E assignmentsTable = roomsExpandAssignments.invoke(roomsTable, "Assignments"); studentTablehasDone.invoke(studentsTable, assignmentsTable); - assertThat(assignmentsTable.toString(), containsString("Alice m4242 \twa1337 Math \tintegrals")); - assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \twa1337 Math \tmatrices"))); + assertThat(assignmentsTable.toString(), containsString("Alice m4242 \t| wa1337 Math \t| integrals")); + assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \t| wa1337 Math \t| matrices"))); // select columns uniTable = declaredConstructors.newInstance(uniArray); @@ -276,8 +276,8 @@ private void runTableTests(ClassLoader classLoader, String packageName) throws E assignmentsTable = roomsExpandAssignments.invoke(roomsTable, "Assignments"); studentTableSelectColumns.invoke(studentsTable, new Object[] { new String[] { "Students", "Rooms" } }); - assertThat(assignmentsTable.toString(), containsString("Alice m4242 \twa1337 Math")); - assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \twa1337 Math \tintegrals"))); + assertThat(assignmentsTable.toString(), containsString("Alice m4242 \t| wa1337 Math")); + assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \t| wa1337 Math \t| integrals"))); // drop columns uniTable = declaredConstructors.newInstance(uniArray); @@ -286,8 +286,8 @@ private void runTableTests(ClassLoader classLoader, String packageName) throws E assignmentsTable = roomsExpandAssignments.invoke(roomsTable, "Assignments"); studentTableDropColumns.invoke(studentsTable, new Object[] { new String[] { "Assignments" } }); - assertThat(assignmentsTable.toString(), containsString("Alice m4242 \twa1337 Math")); - assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \twa1337 Math \tintegrals"))); + assertThat(assignmentsTable.toString(), containsString("Alice m4242 \t| wa1337 Math")); + assertThat(assignmentsTable.toString(), not(containsString("Alice m4242 \t| wa1337 Math \t| integrals"))); // add column uniTable = declaredConstructors.newInstance(uniArray);