Source:
<code>public void given_multibranchWithSources_when_createEventWhileIndexing_then_onlyOneBuildCreated() throws Exception { try (MockSCMController c = MockSCMController.create()) { c.createRepository("foo"); BasicMultiBranchProject prj = r.jenkins.createProject(BasicMultiBranchProject.class, "foo"); prj.setCriteria(null); prj.getSourcesList().add(new BranchSource(new MockSCMSource(null, c, "foo", true, false, false))); c.withLatency(MockLatency.fixed(100, TimeUnit.MILLISECONDS)); long lastModified = prj.getComputation().getEventsFile().lastModified(); QueueTaskFuture<Queue.Executable> future = prj.scheduleBuild2(0).getFuture(); SCMHeadEvent.fireNow(new MockSCMHeadEvent(SCMEvent.Type.CREATED, c, "foo", "master", c.getRevision("foo", "master"))); future.get(); FreeStyleProject master = prj.getItem("master"); waitUntilNoActivityIgnoringThreadDeathUpTo(10000); assertThat(prj.getComputation().getEventsFile().lastModified(), greaterThan(lastModified)); assertThat("The master branch was built once only", master.getLastBuild().getNumber(), is(1)); assertThat(master.getLastBuild().getResult(), is(Result.SUCCESS)); List<Throwable> deaths = new ArrayList<Throwable>(); for (Computer comp : r.jenkins.getComputers()) { for (Executor e : comp.getExecutors()) { <START> if (e.getCauseOfDeath() != null) { <END> deaths.add(e.getCauseOfDeath()); } } for (Executor e : comp.getOneOffExecutors()) { if (e.getCauseOfDeath() != null) { deaths.add(e.getCauseOfDeath()); } } } assertThat("None of the executors have died abnormally", deaths, containsInAnyOrder()); } }</code><technical_language>I suggest #92 first, is simple I uncontroversial (would defend manner of other mistakes), adapting this verify revised lesser symptoms do occur-namely, a failed indexing run</technical_language>

Target:
public void given_multibranchWithSources_when_createEventWhileIndexing_then_onlyOneBuildCreated() throws Exception { try (MockSCMController c = MockSCMController.create()) { c.createRepository("foo"); BasicMultiBranchProject prj = r.jenkins.createProject(BasicMultiBranchProject.class, "foo"); prj.setCriteria(null); prj.getSourcesList().add(new BranchSource(new MockSCMSource(null, c, "foo", true, false, false))); c.withLatency(MockLatency.fixed(100, TimeUnit.MILLISECONDS)); long lastModified = prj.getComputation().getEventsFile().lastModified(); QueueTaskFuture<Queue.Executable> future = prj.scheduleBuild2(0).getFuture(); SCMHeadEvent.fireNow(new MockSCMHeadEvent( "given_multibranchWithSources_when_createEventWhileIndexing_then_onlyOneBuildCreated", SCMEvent.Type.CREATED, c, "foo", "master", c.getRevision("foo", "master") )); future.get(); FreeStyleProject master = prj.getItem("master"); waitUntilNoActivityIgnoringThreadDeathUpTo(10000); assertThat(prj.getComputation().getEventsFile().lastModified(), greaterThan(lastModified)); assertThat("The master branch was built once only", master.getLastBuild().getNumber(), is(1)); assertThat(master.getLastBuild().getResult(), is(Result.SUCCESS)); List<Throwable> deaths = new ArrayList<Throwable>(); for (Computer comp : r.jenkins.getComputers()) { for (Executor e : comp.getExecutors()) { if (e.getCauseOfDeath() != null) { deaths.add(e.getCauseOfDeath()); } } for (Executor e : comp.getOneOffExecutors()) { if (e.getCauseOfDeath() != null) { deaths.add(e.getCauseOfDeath()); } } } assertThat("None of the executors have died abnormally", deaths, containsInAnyOrder()); } }