@Test
public void testGetContent_shouldGetPreviousBuildsThatArentUnstable_HUDSON3519()
throws Exception {
// Test for HUDSON-3519
AbstractBuild successfulBuild = createBuild(Result.SUCCESS, 2, "Changes for a successful build.");
AbstractBuild unstableBuild = createBuild(Result.UNSTABLE, 3, "Changes for an unstable build.");
when(unstableBuild.getPreviousBuild()).thenReturn(successfulBuild);
when(successfulBuild.getNextBuild()).thenReturn(unstableBuild);
AbstractBuild abortedBuild = createBuild(Result.ABORTED, 4, "Changes for an aborted build.");
when(abortedBuild.getPreviousBuild()).thenReturn(unstableBuild);
when(unstableBuild.getNextBuild()).thenReturn(abortedBuild);
AbstractBuild failureBuild = createBuild(Result.FAILURE, 5, "Changes for a failed build.");
when(failureBuild.getPreviousBuild()).thenReturn(abortedBuild);
when(abortedBuild.getNextBuild()).thenReturn(failureBuild);
AbstractBuild notBuiltBuild = createBuild(Result.NOT_BUILT, 6, "Changes for a not-built build.");
when(notBuiltBuild.getPreviousBuild()).thenReturn(failureBuild);
when(failureBuild.getNextBuild()).thenReturn(notBuiltBuild);
AbstractBuild currentBuild = createBuild(Result.UNSTABLE, 7, "Changes for an unstable build.");
when(currentBuild.getPreviousBuild()).thenReturn(notBuiltBuild);
when(notBuiltBuild.getNextBuild()).thenReturn(currentBuild);
String contentStr = content.evaluate(currentBuild, listener, ChangesSinceLastUnstableBuildContent.MACRO_NAME);
assertEquals(