@Test public void registerTwoTraceForOneTestCase(){ tracePool.registerNewCoverageData("test0",null); try { tracePool.registerNewCoverageData("test0",null); Assert.fail("IllegalStateException is expected!"); }catch (IllegalStateException e){ assert (e.getMessage().equals("Coverage data for test"+"test0"+"is already available.")); } }
public void registerNewCoverageData(String testName, ExecutionTrace executionTrace){ if(this.pool.containsKey(testName)){ throw new IllegalStateException("Coverage data for test"+testName+"is already available."); } this.pool.put(testName,executionTrace); }
ExecutionTracePool { public void registerNewCoverageData(String testName, ExecutionTrace executionTrace){ if(this.pool.containsKey(testName)){ throw new IllegalStateException("Coverage data for test"+testName+"is already available."); } this.pool.put(testName,executionTrace); } }
ExecutionTracePool { public void registerNewCoverageData(String testName, ExecutionTrace executionTrace){ if(this.pool.containsKey(testName)){ throw new IllegalStateException("Coverage data for test"+testName+"is already available."); } this.pool.put(testName,executionTrace); } private  ExecutionTracePool(); }
ExecutionTracePool { public void registerNewCoverageData(String testName, ExecutionTrace executionTrace){ if(this.pool.containsKey(testName)){ throw new IllegalStateException("Coverage data for test"+testName+"is already available."); } this.pool.put(testName,executionTrace); } private  ExecutionTracePool(); static ExecutionTracePool getInstance(); void registerNewCoverageData(String testName, ExecutionTrace executionTrace); Set<String> getExecutedTests(); ExecutionTrace getExecutionTrace(String testName); Collection<ExecutionTrace> getExecutionTraces(); void clear(); }
ExecutionTracePool { public void registerNewCoverageData(String testName, ExecutionTrace executionTrace){ if(this.pool.containsKey(testName)){ throw new IllegalStateException("Coverage data for test"+testName+"is already available."); } this.pool.put(testName,executionTrace); } private  ExecutionTracePool(); static ExecutionTracePool getInstance(); void registerNewCoverageData(String testName, ExecutionTrace executionTrace); Set<String> getExecutedTests(); ExecutionTrace getExecutionTrace(String testName); Collection<ExecutionTrace> getExecutionTraces(); void clear();  }