@Test
  public void loadBuildTypeList_callback_dispatches_parent_project_on_event_bus() throws Exception {
    // Setup
    final ProjectData project = new ProjectData("p1", "pname", Optional.<String>empty());
    final ProjectData project2 = new ProjectData("p2", "pname", Optional.<String>empty());
    _projectManager.registerProjects(ImmutableList.of(project, project2));

    final BuildTypeList buildTypelist = new BuildTypeList();
    buildTypelist.addBuildType(new BuildType("bt1", "btName", "pname", "p2"));

    when(_mockRequestController.sendRequest(getApiVersion(), "buildTypes", BuildTypeList.class))
        .thenReturn(Futures.immediateFuture(buildTypelist));
    // Exercise
    _apiController.loadBuildTypeList();
    // Verify
    assertThat(_dispatchedObjects, not(hasItem(project)));
    assertThat(_dispatchedObjects, hasItem(project2));
  }
  @Test
  public void
      loadBuildTypeList_callback_registers_project_to_BuildTypeManager_and_dispatch_it_on_event_bus()
          throws Exception {
    // Setup
    final BuildTypeList buildTypelist = new BuildTypeList();
    buildTypelist.addBuildType(new BuildType("bt1", "btName", "btProjectName", "btProjectId"));
    buildTypelist.addBuildType(new BuildType("bt2", "btName", "btProjectName", "btProjectId"));

    when(_mockRequestController.sendRequest(getApiVersion(), "buildTypes", BuildTypeList.class))
        .thenReturn(Futures.immediateFuture(buildTypelist));
    // Exercise
    final ListenableFuture<Void> ackFuture = _apiController.loadBuildTypeList();
    // Verify
    assertThat(_buildTypeManager.getBuildTypes().size(), is(2));
    assertThat(_buildTypeManager.getBuildTypes().get(0).getId(), is("bt1"));
    assertThat(_buildTypeManager.getBuildTypes().get(1).getId(), is("bt2"));
    assertThat(_dispatchedObjects, hasItem(_buildTypeManager));
    assertThat(ackFuture.isDone(), is(true));
  }