int expectedBuildNumber = projectB.getNextBuildNumber();
int expectedBuildNumberC = projectC.getNextBuildNumber();
projectA.scheduleBuild2(0, new UserCause()).get();
waitUntilNoActivity();
Run buildB1 = projectB.getBuildByNumber(expectedBuildNumber);
Run buildC1 = projectC.getBuildByNumber(expectedBuildNumberC);
EnvVars envVars = builder.getEnvVars();
//System.out.println("envVars: " + envVars);
assertThat(envVars, notNullValue());
assertThat(envVars, hasEntry("LAST_TRIGGERED_JOB_NAME", "projectB"));
assertThat(envVars, hasEntry("TRIGGERED_BUILD_NUMBER_projectB", Integer.toString(expectedBuildNumber)));
assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB", buildB1.getResult().toString()));
assertThat(envVars, hasEntry("TRIGGERED_BUILD_RESULT_projectB_RUN_" + Integer.toString(expectedBuildNumber), buildB1.getResult().toString()));
assertThat(envVars, hasEntry("TRIGGERED_BUILD_RUN_COUNT_projectB", "1"));
assertThat(envVars, hasEntry("TRIGGERED_JOB_NAMES", "projectB"));
// check that we don't see entries for projectC
assertThat(envVars, not(hasEntry("TRIGGERED_BUILD_NUMBER_projectC", Integer.toString(expectedBuildNumberC))));
assertThat(envVars, not(hasEntry("TRIGGERED_BUILD_RESULT_projectC_RUN_" + Integer.toString(expectedBuildNumberC), buildC1.getResult().toString())));
}