@Test public void runTest_resTypeIsPass() { when(burstArray[0].getBurstCategory()).thenReturn(BurstCategory.SCREEN_ROTATION); when(burstArray[0].getBeginTime()).thenReturn(1.0); when(burstArray[0].getEndTime()).thenReturn(5.0); when(burstArray[1].getBurstCategory()).thenReturn(BurstCategory.CPU); when(burstArray[1].getEndTime()).thenReturn(6.0); List<Burst> burstCollection = new ArrayList<Burst>(); burstCollection.add(burstArray[0]); burstCollection.add(burstArray[1]); Mockito.when(burstCollectionAnalysisData.getBurstCollection()).thenReturn(burstCollection); Mockito.when(tracedata.getBurstCollectionAnalysisData()).thenReturn(burstCollectionAnalysisData); unConnImpl = (UnnecessaryConnectionImpl) context.getBean("unnecessaryConnection"); unConnImpl.runTest(tracedata); AbstractBestPracticeResult result = unConnImpl.runTest(tracedata); assertEquals(BPResultType.PASS, result.getResultType()); }
@Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { UnnecessaryConnectionResult result = new UnnecessaryConnectionResult(); ucEntryList = new ArrayList<UnnecessaryConnectionEntry>(); validateUnnecessaryConnections(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(tightlyCoupledBurstCount < 4){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format(this.textResults, this.tightlyCoupledBurstCount); result.setResultText(text); } result.setTightlyCoupledBurstCount(tightlyCoupledBurstCount); result.setTightlyCoupledBurstTime(tightlyCoupledBurstTime); result.setTightlyCoupledBurstsDetails(ucEntryList); result.setSelfTest(false); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllMultiConnDesc(exportAllMultiConnDesc); return result; }
UnnecessaryConnectionImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { UnnecessaryConnectionResult result = new UnnecessaryConnectionResult(); ucEntryList = new ArrayList<UnnecessaryConnectionEntry>(); validateUnnecessaryConnections(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(tightlyCoupledBurstCount < 4){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format(this.textResults, this.tightlyCoupledBurstCount); result.setResultText(text); } result.setTightlyCoupledBurstCount(tightlyCoupledBurstCount); result.setTightlyCoupledBurstTime(tightlyCoupledBurstTime); result.setTightlyCoupledBurstsDetails(ucEntryList); result.setSelfTest(false); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllMultiConnDesc(exportAllMultiConnDesc); return result; } }
UnnecessaryConnectionImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { UnnecessaryConnectionResult result = new UnnecessaryConnectionResult(); ucEntryList = new ArrayList<UnnecessaryConnectionEntry>(); validateUnnecessaryConnections(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(tightlyCoupledBurstCount < 4){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format(this.textResults, this.tightlyCoupledBurstCount); result.setResultText(text); } result.setTightlyCoupledBurstCount(tightlyCoupledBurstCount); result.setTightlyCoupledBurstTime(tightlyCoupledBurstTime); result.setTightlyCoupledBurstsDetails(ucEntryList); result.setSelfTest(false); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllMultiConnDesc(exportAllMultiConnDesc); return result; }  }
UnnecessaryConnectionImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { UnnecessaryConnectionResult result = new UnnecessaryConnectionResult(); ucEntryList = new ArrayList<UnnecessaryConnectionEntry>(); validateUnnecessaryConnections(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(tightlyCoupledBurstCount < 4){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format(this.textResults, this.tightlyCoupledBurstCount); result.setResultText(text); } result.setTightlyCoupledBurstCount(tightlyCoupledBurstCount); result.setTightlyCoupledBurstTime(tightlyCoupledBurstTime); result.setTightlyCoupledBurstsDetails(ucEntryList); result.setSelfTest(false); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllMultiConnDesc(exportAllMultiConnDesc); return result; }  @Override AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata); }
UnnecessaryConnectionImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { UnnecessaryConnectionResult result = new UnnecessaryConnectionResult(); ucEntryList = new ArrayList<UnnecessaryConnectionEntry>(); validateUnnecessaryConnections(tracedata.getBurstCollectionAnalysisData().getBurstCollection()); if(tightlyCoupledBurstCount < 4){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); String text = MessageFormat.format(this.textResults, this.tightlyCoupledBurstCount); result.setResultText(text); } result.setTightlyCoupledBurstCount(tightlyCoupledBurstCount); result.setTightlyCoupledBurstTime(tightlyCoupledBurstTime); result.setTightlyCoupledBurstsDetails(ucEntryList); result.setSelfTest(false); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllMultiConnDesc(exportAllMultiConnDesc); return result; }  @Override AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata);  }