@Test public void runTest_resIsNoErr_Pass() { tracedata = Mockito.mock(PacketAnalyzerResult.class); burstCollectionAnalysisData = Mockito.mock(BurstCollectionAnalysisData.class); burst01 = mock(Burst.class); Mockito.when(burst01.getBurstCategory()).thenReturn(BurstCategory.UNKNOWN); Mockito.when(burst01.getBeginTime()).thenReturn(1.0); List<Burst> burstCollection = new ArrayList<Burst>(); burstCollection.add(burst01); Mockito.when(tracedata.getBurstCollectionAnalysisData()).thenReturn(burstCollectionAnalysisData); Mockito.when(burstCollectionAnalysisData.getBurstCollection()).thenReturn(burstCollection); screenRotationImpl = (ScreenRotationImpl) context.getBean("screenRotation"); AbstractBestPracticeResult result = screenRotationImpl.runTest(tracedata); assertEquals(BPResultType.PASS, result.getResultType()); }
@Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { ScreenRotationResult result = new ScreenRotationResult(); boolean passScreenRotation = true; double screenRotationBurstTime = 0.0; for(Burst burst:tracedata.getBurstCollectionAnalysisData().getBurstCollection()){ if(burst.getBurstCategory() == BurstCategory.SCREEN_ROTATION){ passScreenRotation = false; screenRotationBurstTime = burst.getBeginTime(); break; } } result.setScreenRotationBurstTime(screenRotationBurstTime); if(passScreenRotation){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); result.setResultText(textResults); } result.setScreenRotationBurstTime(screenRotationBurstTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllScreenRotationDescPass(exportAllScreenRotationDescPass); result.setExportAllScreenRotationFailed(exportAllScreenRotationFailed); return result; }
ScreenRotationImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { ScreenRotationResult result = new ScreenRotationResult(); boolean passScreenRotation = true; double screenRotationBurstTime = 0.0; for(Burst burst:tracedata.getBurstCollectionAnalysisData().getBurstCollection()){ if(burst.getBurstCategory() == BurstCategory.SCREEN_ROTATION){ passScreenRotation = false; screenRotationBurstTime = burst.getBeginTime(); break; } } result.setScreenRotationBurstTime(screenRotationBurstTime); if(passScreenRotation){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); result.setResultText(textResults); } result.setScreenRotationBurstTime(screenRotationBurstTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllScreenRotationDescPass(exportAllScreenRotationDescPass); result.setExportAllScreenRotationFailed(exportAllScreenRotationFailed); return result; } }
ScreenRotationImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { ScreenRotationResult result = new ScreenRotationResult(); boolean passScreenRotation = true; double screenRotationBurstTime = 0.0; for(Burst burst:tracedata.getBurstCollectionAnalysisData().getBurstCollection()){ if(burst.getBurstCategory() == BurstCategory.SCREEN_ROTATION){ passScreenRotation = false; screenRotationBurstTime = burst.getBeginTime(); break; } } result.setScreenRotationBurstTime(screenRotationBurstTime); if(passScreenRotation){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); result.setResultText(textResults); } result.setScreenRotationBurstTime(screenRotationBurstTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllScreenRotationDescPass(exportAllScreenRotationDescPass); result.setExportAllScreenRotationFailed(exportAllScreenRotationFailed); return result; }  }
ScreenRotationImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { ScreenRotationResult result = new ScreenRotationResult(); boolean passScreenRotation = true; double screenRotationBurstTime = 0.0; for(Burst burst:tracedata.getBurstCollectionAnalysisData().getBurstCollection()){ if(burst.getBurstCategory() == BurstCategory.SCREEN_ROTATION){ passScreenRotation = false; screenRotationBurstTime = burst.getBeginTime(); break; } } result.setScreenRotationBurstTime(screenRotationBurstTime); if(passScreenRotation){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); result.setResultText(textResults); } result.setScreenRotationBurstTime(screenRotationBurstTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllScreenRotationDescPass(exportAllScreenRotationDescPass); result.setExportAllScreenRotationFailed(exportAllScreenRotationFailed); return result; }  @Override AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata); }
ScreenRotationImpl implements IBestPractice { @Override public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) { ScreenRotationResult result = new ScreenRotationResult(); boolean passScreenRotation = true; double screenRotationBurstTime = 0.0; for(Burst burst:tracedata.getBurstCollectionAnalysisData().getBurstCollection()){ if(burst.getBurstCategory() == BurstCategory.SCREEN_ROTATION){ passScreenRotation = false; screenRotationBurstTime = burst.getBeginTime(); break; } } result.setScreenRotationBurstTime(screenRotationBurstTime); if(passScreenRotation){ result.setResultType(BPResultType.PASS); result.setResultText(textResultPass); }else{ result.setResultType(BPResultType.FAIL); result.setResultText(textResults); } result.setScreenRotationBurstTime(screenRotationBurstTime); result.setAboutText(aboutText); result.setDetailTitle(detailTitle); result.setLearnMoreUrl(learnMoreUrl); result.setOverviewTitle(overviewTitle); result.setExportAllScreenRotationDescPass(exportAllScreenRotationDescPass); result.setExportAllScreenRotationFailed(exportAllScreenRotationFailed); return result; }  @Override AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata);  }