@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); }