Source:
public void testAppliesToExperiment() { ITmfTrace trace1 = TmfTestTrace.A_TEST_10K.getTrace(); ITmfTrace trace2 = TmfTestTrace.A_TEST_10K2.getTrace(); ITmfTrace trace3 = TmfTestTrace.A_TEST_10K2.getTraceAsStub2(); ITmfTrace[] tracesExp1 = { trace1, trace2 }; TmfExperiment exp1 = new TmfExperiment(tracesExp1[0].getEventType(), "Experiment 1", tracesExp1, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null); ITmfTrace[] tracesExp2 = { trace1, trace3 }; TmfExperiment exp2 = new TmfExperiment(tracesExp2[0].getEventType(), "Experiment 1", tracesExp2, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null); try { Exception exception = null; IAnalysisModule module = null; try { module = fModule.newModule(exp1); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNotNull(exception); exception = null; try { module = fModule.newModule(exp2); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNotNull(exception); exception = null; try { module = fModuleOther.newModule(exp1); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNotNull(exception); exception = null; try { module = fModuleOther.newModule(exp2); assertNotNull(module); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNull(exception); } finally { exp2.dispose(); exp1.dispose(); } }

Target:
public void testAppliesToExperiment() { ITmfTrace trace1 = TmfTestTrace.A_TEST_10K.getTrace(); ITmfTrace trace2 = TmfTestTrace.A_TEST_10K2.getTrace(); ITmfTrace trace3 = TmfTestTrace.A_TEST_10K2.getTraceAsStub2(); ITmfTrace[] tracesExp1 = { trace1, trace2 }; TmfExperiment exp1 = new TmfExperiment(tracesExp1[0].getEventType(), "Experiment 1", tracesExp1, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null); ITmfTrace[] tracesExp2 = { trace1, trace3 }; TmfExperiment exp2 = new TmfExperiment(tracesExp2[0].getEventType(), "Experiment 1", tracesExp2, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null); try { Exception exception = null; IAnalysisModule module = null; try { module = fModule.newModule(exp1); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNotNull(exception); assertEquals(NLS.bind(Messages.TmfAnalysisModuleHelper_AnalysisDoesNotApply, fModule.getName()), exception.getMessage()); exception = null; try { module = fModule.newModule(exp2); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNotNull(exception); assertEquals(NLS.bind(Messages.TmfAnalysisModuleHelper_AnalysisDoesNotApply, fModule.getName()), exception.getMessage()); exception = null; try { module = fModuleOther.newModule(exp1); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNotNull(exception); assertEquals(NLS.bind(Messages.TmfAnalysisModuleHelper_AnalysisDoesNotApply, fModuleOther.getName()), exception.getMessage()); exception = null; try { module = fModuleOther.newModule(exp2); assertNotNull(module); } catch (TmfAnalysisException e) { exception = e; } finally { if (module != null) { module.dispose(); } } assertNull(exception); } finally { exp2.dispose(); exp1.dispose(); } }