details: https://code.openbravo.com/erp/devel/pi/rev/14e708fab4b5 changeset: 31740:14e708fab4b5 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Mar 27 10:52:11 2017 +0200 summary: fixed bug 35621: information missing in logs when IndexesTest fails
Now the list of errors is logged as part of failed assertion message instead of within the standard log. diffstat: src-test/src/org/openbravo/test/model/IndexesTest.java | 21 ++++++++++++------ 1 files changed, 14 insertions(+), 7 deletions(-) diffs (45 lines): diff -r 0468ff1f2498 -r 14e708fab4b5 src-test/src/org/openbravo/test/model/IndexesTest.java --- a/src-test/src/org/openbravo/test/model/IndexesTest.java Sat Mar 25 00:52:04 2017 +0000 +++ b/src-test/src/org/openbravo/test/model/IndexesTest.java Mon Mar 27 10:52:11 2017 +0200 @@ -19,7 +19,8 @@ package org.openbravo.test.model; -import static org.junit.Assert.assertEquals; +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertThat; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -111,7 +112,17 @@ + " where indexes_to_parent_first_col = 0" // + " order by parenttable"; - List<String> errors = new ArrayList<String>(); + @SuppressWarnings("serial") + List<String> errors = new ArrayList<String>() { + @Override + public String toString() { + StringBuilder s = new StringBuilder(); + for (String e : this) { + s.append("\n ").append(e); + } + return s.toString(); + } + }; PreparedStatement sqlQuery = null; ResultSet rs = null; try { @@ -134,11 +145,7 @@ errors.add(msg); } - for (String error : errors) { - log.error(error); - } - - assertEquals("There are missing indexes!", 0, errors.size()); + assertThat("No subtabs without index to parent tab:" + errors, errors, hasSize(0)); } catch (Exception e) { log.error("Error when executing query", e); } finally { ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits