@Test
public void testLaunchSunnyDay() throws Exception {
LaunchRequest request = new LaunchRequest();
jobService.launch("foo", new JobParameters());
EasyMock.expectLastCall().andReturn(MetaDataInstanceFactory.createJobExecution());
jobService.listJobInstances("foo", 0, 20);
EasyMock.expectLastCall().andReturn(Arrays.asList(MetaDataInstanceFactory.createJobInstance()));
jobService.getJobExecutionsForJobInstance("foo", 12L);
EasyMock.expectLastCall()
.andReturn(Arrays.asList(MetaDataInstanceFactory.createJobExecution("foo", 12L, 123L)));
jobService.countJobExecutionsForJob("foo");
EasyMock.expectLastCall().andReturn(12);
jobService.countJobInstances("foo");
EasyMock.expectLastCall().andReturn(100);
jobService.isLaunchable("foo");
EasyMock.expectLastCall().andReturn(true);
jobService.isIncrementable("foo");
EasyMock.expectLastCall().andReturn(true);
jobService.getLastJobParameters("foo");
EasyMock.expectLastCall().andReturn(new JobParameters());
EasyMock.replay(jobService);
ExtendedModelMap model = new ExtendedModelMap();
controller.launch(model, "foo", request, new BindException(request, "request"), "job");
assertEquals("foo", request.getJobName());