tzaeschke commented on code in PR #85: URL: https://github.com/apache/db-jdo/pull/85#discussion_r1398193849
########## tck/src/main/java/org/apache/jdo/tck/api/jdohelper/IsDetached.java: ########## @@ -35,29 +36,23 @@ public class IsDetached extends DetachTest { private static final String ASSERTION_FAILED = "Assertion A8.5.6-1 JDOHelper.isDetached(Object) failed: "; - /** - * The <code>main</code> is called when the class is directly executed from the command line. - * - * @param args The arguments passed to the program. - */ - public static void main(String[] args) { - BatchTestRunner.run(IsDetached.class); - } - + @Test public void testNullTransientAndUndetachableIsDetachedFalse() { pm = getPM(); pm.currentTransaction().begin(); - assertFalse(ASSERTION_FAILED + "null object is detached", JDOHelper.isDetached(null)); - assertFalse( - ASSERTION_FAILED + "transient object is detached", JDOHelper.isDetached(new Cart("bob"))); - assertFalse( - ASSERTION_FAILED + "object of class marked not detachabled is detached", - JDOHelper.isDetached(new Undetachable())); + Assertions.assertFalse( Review Comment: Using `Assertions.` instead of static import, is that a preferred style or pragmatic/convenience (which also would be totally reasonable considering the amount of changes)? ########## tck/src/main/java/org/apache/jdo/tck/util/ResultSummary.java: ########## @@ -36,9 +37,14 @@ public class ResultSummary implements Serializable { /** The name of the file to store a serialized instance of this class. */ private static final String FILE_NAME_OF_RESULT_SUMMARY = "ResultSummary.ser"; + private static final DecimalFormat THREE_DIGITS_FORMATTER = new DecimalFormat("000"); Review Comment: What are these for? They don't appear to be used...? ########## tck/src/main/java/org/apache/jdo/tck/util/SystemCfgSummary.java: ########## @@ -78,7 +88,7 @@ static String getSystemInfo() { * @param path the path * @param message the message */ - static void saveSystemInfo(String path, String message) { + private void saveSystemInfo(String path, String message) { Review Comment: I think this could remain 'static'. ########## tck/src/main/java/org/apache/jdo/tck/util/SystemCfgSummary.java: ########## @@ -31,7 +31,9 @@ public class SystemCfgSummary { /** The name of the system configuration summary file. */ private static final String SYSCFG_FILE_NAME = "system_config.txt"; - private static String newLine; + private static String NL = System.getProperty("line.separator"); Review Comment: Make 'final'? ########## tck/src/main/java/org/apache/jdo/tck/util/ResultSummary.java: ########## @@ -135,23 +139,48 @@ private static ResultSummary load(String directory) { * * @param result the result object */ - private void increment(TestResult result) { + private void increment(TestExecutionSummary result) { + // total numbers this.nrOfTotalConfigurations++; - this.totalTestCount += result.runCount(); - if (!result.wasSuccessful()) { + this.totalTestCount += result.getTestsFoundCount(); + if (result.getTestsFailedCount() > 0) { this.nrOfFailedConfigurations++; - this.totalFailureCount += result.failureCount(); - this.totalErrorCount += result.errorCount(); + this.totalFailureCount += result.getTestsFailedCount(); } } + private void appendTestResult( + String directory, String idtype, String config, TestExecutionSummary result) { + String resultFileName = directory + File.separator + RESULT_FILE_NAME; + String header = "Running tests for " + config + " with " + idtype + ":" + NEWLINE + " "; + StringBuilder builder = new StringBuilder(header); + builder.append(getTestResult(result)); + appendTCKResultMessage(resultFileName, builder.toString()); + } + + private String getTestResult(TestExecutionSummary summary) { + StringBuilder builder = new StringBuilder(); + builder.append(summary.getTestsFailedCount() == 0 ? "OK " : "** "); + builder.append("Tests found: ").append(summary.getTestsFoundCount()); + builder.append(", started: ").append(summary.getTestsStartedCount()); + builder.append(", succeeded: ").append(summary.getTestsSucceededCount()); + builder.append(", failed: ").append(summary.getTestsFailedCount()); + builder.append(", skipped: ").append(summary.getTestsSkippedCount()); + builder.append(", aborted: ").append(summary.getTestsAbortedCount()); + builder + .append(", time: ") + .append(((double) (summary.getTimeFinished() - summary.getTimeStarted()) / 1000.0)) Review Comment: I think the cast to `double` is unnecessary. ########## tck/src/main/java/org/apache/jdo/tck/api/jdohelper/IsDetached.java: ########## @@ -35,29 +36,23 @@ public class IsDetached extends DetachTest { private static final String ASSERTION_FAILED = "Assertion A8.5.6-1 JDOHelper.isDetached(Object) failed: "; - /** Review Comment: I wonder why these exist, may people be using these main methods? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jdo-dev-unsubscr...@db.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org