assertTrue(project.getBuildByNumber(7).getHasArtifacts());
}
@Bug(2417)
public void testStableVsUnstable() throws Exception {
FreeStyleProject project = createFreeStyleProject();
Publisher artifactArchiver = new ArtifactArchiver("f", "", true);
project.getPublishersList().replaceBy(Collections.singleton(artifactArchiver));
project.getBuildersList().replaceBy(Collections.singleton(new CreateArtifact()));
assertEquals(Result.SUCCESS, build(project)); // #1
assertTrue(project.getBuildByNumber(1).getHasArtifacts());
project.getPublishersList().replaceBy(Arrays.asList(artifactArchiver, new TestsFail()));
assertEquals(Result.UNSTABLE, build(project)); // #2
assertTrue(project.getBuildByNumber(1).getHasArtifacts());
assertTrue(project.getBuildByNumber(2).getHasArtifacts());
assertEquals(Result.UNSTABLE, build(project)); // #3
assertTrue(project.getBuildByNumber(1).getHasArtifacts());
assertTrue(project.getBuildByNumber(2).getHasArtifacts());
assertTrue(project.getBuildByNumber(3).getHasArtifacts());
assertEquals(Result.UNSTABLE, build(project)); // #4
assertTrue(project.getBuildByNumber(1).getHasArtifacts());
assertFalse(project.getBuildByNumber(2).getHasArtifacts());
assertTrue(project.getBuildByNumber(3).getHasArtifacts());
assertTrue(project.getBuildByNumber(4).getHasArtifacts());
project.getPublishersList().replaceBy(Collections.singleton(artifactArchiver));
assertEquals(Result.SUCCESS, build(project)); // #5
assertTrue(project.getBuildByNumber(1).getHasArtifacts());
assertFalse(project.getBuildByNumber(2).getHasArtifacts());
assertFalse(project.getBuildByNumber(3).getHasArtifacts());
assertTrue(project.getBuildByNumber(4).getHasArtifacts());
assertTrue(project.getBuildByNumber(5).getHasArtifacts());
assertEquals(Result.SUCCESS, build(project)); // #6
assertFalse(project.getBuildByNumber(1).getHasArtifacts());
assertFalse(project.getBuildByNumber(2).getHasArtifacts());
assertFalse(project.getBuildByNumber(3).getHasArtifacts());
assertFalse(project.getBuildByNumber(4).getHasArtifacts());
assertTrue(project.getBuildByNumber(5).getHasArtifacts());
assertTrue(project.getBuildByNumber(6).getHasArtifacts());
}