@Test public void isFirstAnalysis_return_true() throws Exception { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setBaseProjectSnapshot(null); assertThat(underTest.isFirstAnalysis()).isTrue(); }
@Test public void isFirstAnalysis_return_false() throws Exception { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setBaseProjectSnapshot(BASE_PROJECT_SNAPSHOT); assertThat(underTest.isFirstAnalysis()).isFalse(); }
@Test public void getRootComponentRef() throws InterruptedException { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setRootComponentRef(10); assertThat(underTest.getRootComponentRef()).isEqualTo(10); }
@Test public void set_no_branch() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setBranch(null); assertThat(underTest.getBranch()).isNull(); }
@Test public void set_branch() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setBranch("origin/master"); assertThat(underTest.getBranch()).isEqualTo("origin/master"); }
@Test public void isCrossProjectDuplicationEnabled_return_false() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setCrossProjectDuplicationEnabled(false); assertThat(underTest.isCrossProjectDuplicationEnabled()).isEqualTo(false); }
@Test public void setBaseProjectSnapshot_throws_ISE_when_called_twice() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setBaseProjectSnapshot(BASE_PROJECT_SNAPSHOT); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Base project snapshot has already been set"); underTest.setBaseProjectSnapshot(BASE_PROJECT_SNAPSHOT); }
@Test public void getAnalysisDate_returns_date_with_same_time_as_the_one_set_with_setAnalysisDate() throws InterruptedException { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setAnalysisDate(SOME_DATE); assertThat(underTest.getAnalysisDate()).isEqualTo(SOME_DATE); }
@Test public void setRootComponentRef_throws_ISE_when_called_twice() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setRootComponentRef(10); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Root component ref has already been set"); underTest.setRootComponentRef(9); }
@Test public void setBranch_throws_ISE_when_called_twice() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setBranch("origin/master"); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Branch has already been set"); underTest.setBranch("origin/master"); }
@Test public void setIsCrossProjectDuplicationEnabled_throws_ISE_when_called_twice() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setCrossProjectDuplicationEnabled(true); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Cross project duplication flag has already been set"); underTest.setCrossProjectDuplicationEnabled(false); }
@Test public void setAnalysisDate_throws_ISE_when_called_twice() { AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(); underTest.setAnalysisDate(SOME_DATE); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Analysis date has already been set"); underTest.setAnalysisDate(SOME_DATE); }