@Test
  public void buildLatestBuildList() throws Exception {
    Mockito.when(securityClientMock.execute(Mockito.any(URL.class)))
        .thenReturn(
            IOUtils.toString(
                JenkinsRequestManagerTest.class.getResourceAsStream("JenkinsRss.xml")));

    Map<String, Build> actualJobBuildMap = requestManager.loadJenkinsRssLatestBuilds(configuration);

    Map<String, Build> expectedJobBuildMap =
        buildLastJobResultMap(
            new String[][] {
              {
                "infra_main_svn_to_git",
                "http://ci.jenkins-ci.org/job/infra_main_svn_to_git/351/",
                "351",
                BuildStatusEnum.SUCCESS.getStatus()
              },
              {
                "TESTING-HUDSON-7434",
                "http://ci.jenkins-ci.org/job/TESTING-HUDSON-7434/2/",
                "2",
                BuildStatusEnum.FAILURE.getStatus()
              },
              {
                "infa_release.rss",
                "http://ci.jenkins-ci.org/job/infa_release.rss/139/",
                "139",
                BuildStatusEnum.SUCCESS.getStatus()
              },
              {
                "infra_jenkins-ci.org_webcontents",
                "http://ci.jenkins-ci.org/job/infra_jenkins-ci.org_webcontents/2/",
                "2",
                BuildStatusEnum.SUCCESS.getStatus()
              },
              {
                "plugins_subversion",
                "http://ci.jenkins-ci.org/job/plugins_subversion/58/",
                "58",
                BuildStatusEnum.FAILURE.getStatus()
              },
              {
                "hudson_metrics_wip",
                "http://ci.jenkins-ci.org/job/hudson_metrics_wip/6/",
                "6",
                BuildStatusEnum.ABORTED.getStatus()
              },
              {
                "gerrit_master",
                "http://ci.jenkins-ci.org/job/gerrit_master/170/",
                "170",
                FAILURE.getStatus()
              },
            });

    assertReflectionEquals(expectedJobBuildMap, actualJobBuildMap);
  }
  @Test
  public void loadView() throws Exception {
    Mockito.when(securityClientMock.execute(Mockito.any(URL.class)))
        .thenReturn(
            IOUtils.toString(
                JenkinsRequestManagerTest.class.getResourceAsStream(
                    "JenkinsRequestManager_loadView.xml")));

    List<Job> actualJobs = requestManager.loadJenkinsView("http://myjenkins/");

    List<Job> expectedJobs = new LinkedList<Job>();

    expectedJobs.add(
        new JobBuilder()
            .job("sql-tools", "blue", "http://myjenkins/job/sql-tools/", "true")
            .lastBuild("http://myjenkins/job/sql-tools/15/", "15", SUCCESS.getStatus(), "false")
            .health("health-80plus", "0 tests en échec sur un total de 24 tests")
            .get());
    expectedJobs.add(
        new JobBuilder().job("db-utils", "grey", "http://myjenkins/job/db-utils/", "false").get());
    expectedJobs.add(
        new JobBuilder()
            .job("myapp", "red", "http://myjenkins/job/myapp/", "false")
            .lastBuild("http://myjenkins/job/myapp/12/", "12", FAILURE.getStatus(), "true")
            .health("health-00to19", "24 tests en échec sur un total de 24 tests")
            .parameter(
                "param1", "ChoiceParameterDefinition", "value1", "value1", "value2", "value3")
            .parameter("runIntegrationTest", "BooleanParameterDefinition", null)
            .get());
    expectedJobs.add(
        new JobBuilder()
            .job("swing-utils", "disabled", "http://myjenkins/job/swing-utils/", "true")
            .lastBuild("http://myjenkins/job/swing-utils/5/", "5", FAILURE.getStatus(), "false")
            .health("health20to39", "0 tests en échec sur un total de 24 tests")
            .parameter("dummyParam", null, null)
            .get());

    assertReflectionEquals(expectedJobs, actualJobs);
  }