Index: punit/src/org/punit/method/runner/AbstractMethodRunner.java =================================================================== --- punit/src/org/punit/method/runner/AbstractMethodRunner.java (revision 232) +++ punit/src/org/punit/method/runner/AbstractMethodRunner.java (working copy) @@ -55,6 +55,7 @@ public AbstractMethodRunner() { _watchers.add(_timeWatcher); + _shouldStop = true; } public void setEventListeners(List eventListeners) { @@ -174,9 +175,6 @@ } }, toWork); _shouldStop = false; - } else { - _shouldStop = true; - _toStopThread = null; } } Index: punit/src/org/punit/reporter/stream/StreamLogger.java =================================================================== --- punit/src/org/punit/reporter/stream/StreamLogger.java (revision 232) +++ punit/src/org/punit/reporter/stream/StreamLogger.java (working copy) @@ -106,7 +106,7 @@ } public void onClassStart(Object testInstance) { - logln(testInstance.getClass().getName(), Level.INFO); + // logln(testInstance.getClass().getName(), Level.INFO); } public void onClassEnd(Object testInstance, Throwable t) { Index: punit/src/org/punit/util/MemoryUtil.java =================================================================== --- punit/src/org/punit/util/MemoryUtil.java (revision 232) +++ punit/src/org/punit/util/MemoryUtil.java (working copy) @@ -6,63 +6,20 @@ public class MemoryUtil { private static Runtime _runtime = Runtime.getRuntime(); - - private static long freeMemory() { - return _runtime.freeMemory(); - } - + public static long totalMemory() { return _runtime.totalMemory(); } public static long usedMemory() { - clear(); - return totalMemory() - freeMemory(); + return totalMemory() - _runtime.freeMemory(); } public static void clear() { - final int CLEAR_RETRIES = 3; - - long free; - - // continue while amount of free memory grows - do { - free = freeMemory(); - for (int i = 0; i < CLEAR_RETRIES; i++) { - System.gc(); - System.runFinalization(); - // give a finalization thread a chance to do it's job - Thread.yield(); - } - } while (free < freeMemory()); - + System.gc(); + System.runFinalization(); } - - /** - * Allocates objects till OutOfMemoryError is not thrown. - * - * @return total memory when virtual pages can be no longer committed - */ - public static long maxTotalMemory() { - int size = Integer.MAX_VALUE; - - Object[] list = new Object[1]; - - // decrease the chunk size - while (size > 0) { - try { - while (true) { - Object[] newElement = new Object[size]; - newElement[0] = list; - list = newElement; - } - } catch (OutOfMemoryError oome) { - } - size = size / 2; - } - return totalMemory(); - } - + private static final int WILDERNESS_SIZE = 4096; private static byte[] _wilderness; @@ -76,8 +33,6 @@ try { _wilderness = new byte[WILDERNESS_SIZE]; } catch (OutOfMemoryError oome) { - System.out.println("failed to allocate wilderness"); - Thread.dumpStack(); throw new OutOfMemoryException(oome); } } Index: punit/src/org/punit/util/ReflectionUtil.java =================================================================== --- punit/src/org/punit/util/ReflectionUtil.java (revision 232) +++ punit/src/org/punit/util/ReflectionUtil.java (working copy) @@ -51,9 +51,6 @@ * the string value to assign */ public static void setField(Object testInstance, Field field, String value) { - // System.out.println("Field = " + field + ", value = " + value); - // System.out.println("value = " + Integer.getInteger(value)); - try { field.setAccessible(true); Class fieldClass = field.getType(); Index: punit/src/org/punit/watcher/CustomWatcher.java =================================================================== --- punit/src/org/punit/watcher/CustomWatcher.java (revision 232) +++ punit/src/org/punit/watcher/CustomWatcher.java (working copy) @@ -18,7 +18,7 @@ private String _name; - private String _unit; + private String _unit; private transient static MethodRunner _methodRunner; @@ -77,7 +77,7 @@ } } } - + public static boolean shouldStop() { return _methodRunner.shouldStop(); } Index: punit/src/punit.properties =================================================================== --- punit/src/punit.properties (revision 232) +++ punit/src/punit.properties (working copy) @@ -1,5 +1,5 @@ builder.01=\ should implement -logger.01=Started running +logger.01=Starting logger.total=total: logger.failures=failures: logger.green=GREEN Index: punit.samples/src/samples/DoSomethingTestClass.java =================================================================== --- punit.samples/src/samples/DoSomethingTestClass.java (revision 232) +++ punit.samples/src/samples/DoSomethingTestClass.java (working copy) @@ -5,19 +5,19 @@ public class DoSomethingTestClass implements Test { public void setUpBeforeWatchers() throws Exception { - System.out.println("This setup will not be caculated into the execution time"); //$NON-NLS-1$ + System.out.println("This setup is not included into the execution time"); //$NON-NLS-1$ } public void setUpAfterWatchers() throws Exception { - System.out.println("This setup will be caculated into the execution time"); //$NON-NLS-1$ + System.out.println("This setup is included into the execution time"); //$NON-NLS-1$ } public void tearDownBeforeWatchers() throws Exception { - System.out.println("This setup will be caculated into the execution time"); //$NON-NLS-1$ + System.out.println("This tear down is included into the execution time"); //$NON-NLS-1$ } public void tearDownAfterWatchers() throws Exception { - System.out.println("This setup will not be caculated into the execution time"); //$NON-NLS-1$ + System.out.println("This setup is not included into the execution time"); //$NON-NLS-1$ } public void testA() { Index: punit.test/src/tests/api/org/punit/util/MemoryUtilTest.java =================================================================== --- punit.test/src/tests/api/org/punit/util/MemoryUtilTest.java (revision 232) +++ punit.test/src/tests/api/org/punit/util/MemoryUtilTest.java (working copy) @@ -12,16 +12,10 @@ public void testUsedMemory() { long used = MemoryUtil.usedMemory(); Assert.assertTrue(used <= MemoryUtil.totalMemory()); - Assert.assertTrue(used <= MemoryUtil.maxTotalMemory()); int size = Math.round((1 - TOLERANCE) * (MemoryUtil.totalMemory() - used)); Object a = new byte[size]; Assert.assertEquals(1, ((float) MemoryUtil.usedMemory() - used) / size, TOLERANCE); } - - public void testTotalMemory() { - Assert.assertTrue(MemoryUtil.totalMemory() <= MemoryUtil - .maxTotalMemory()); - } }