@Test public void testNewInstance() throws InterruptedException { AbstractTest test1 = new MockTest(); AbstractTest test2 = new MockTest(); AbstractTest test3 = new MockTest(); runMap.addTest(test1); runMap.addTest(test2); runMap.addTest(test3); runMap.record(createTestResult(test1, TestResult.Status.PASSED)); runMap.record(createTestResult(test2, TestResult.Status.PASSED)); runMap.record(createTestResult(test3, TestResult.Status.PASSED)); RunMapImpl clone = (RunMapImpl) runMap.newInstance(); Assert.assertEquals(runMap.getTests().size(), clone.getTests().size()); AbstractTest[] cloneTests = clone.getTests().toArray(new AbstractTest[3]); Assert.assertEquals(test1, cloneTests[0]); Assert.assertEquals(test2, cloneTests[1]); Assert.assertEquals(test3, cloneTests[2]); Assert.assertEquals(0, clone.getCurrentTestResults().size()); Assert.assertEquals(0, clone.getRecord(test1).getTotalRuns()); }
public RunMap newInstance() { try { runMapLock.readLock().lock(); return new RunMapImpl(orderedTests); } finally { runMapLock.readLock().unlock(); } }
RunMapImpl implements RunMap { public RunMap newInstance() { try { runMapLock.readLock().lock(); return new RunMapImpl(orderedTests); } finally { runMapLock.readLock().unlock(); } } }
RunMapImpl implements RunMap { public RunMap newInstance() { try { runMapLock.readLock().lock(); return new RunMapImpl(orderedTests); } finally { runMapLock.readLock().unlock(); } } RunMapImpl(); private  RunMapImpl(List<AbstractTest> orderedTests); }
RunMapImpl implements RunMap { public RunMap newInstance() { try { runMapLock.readLock().lock(); return new RunMapImpl(orderedTests); } finally { runMapLock.readLock().unlock(); } } RunMapImpl(); private  RunMapImpl(List<AbstractTest> orderedTests); void addTest(AbstractTest test); TestStatistics getRecord(AbstractTest test); Collection<TestResult> getCurrentTestResults(); Collection<AbstractTest> getTests(); void record(TestResult testResult); Map<AbstractTest, Long> aggregateAndReinitialize(RunMap otherRunmap); void reinitialize(); void reinitStartTimes(); void clearCurrentTestResults(); RunMap newInstance(); }
RunMapImpl implements RunMap { public RunMap newInstance() { try { runMapLock.readLock().lock(); return new RunMapImpl(orderedTests); } finally { runMapLock.readLock().unlock(); } } RunMapImpl(); private  RunMapImpl(List<AbstractTest> orderedTests); void addTest(AbstractTest test); TestStatistics getRecord(AbstractTest test); Collection<TestResult> getCurrentTestResults(); Collection<AbstractTest> getTests(); void record(TestResult testResult); Map<AbstractTest, Long> aggregateAndReinitialize(RunMap otherRunmap); void reinitialize(); void reinitStartTimes(); void clearCurrentTestResults(); RunMap newInstance();  }