@Test
public void testRetract() throws Exception {

  URI mpURI = LiveScheduleServiceImplTest.class.getResource("/live-mp.xml").toURI();
  MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder()
          .loadFromXml(mpURI.toURL().openStream());
  Job job1 = createJob(1L, "anything", "anything");
  Capture<String> capturedMpId = Capture.newInstance();
  EasyMock.expect(searchService.delete(EasyMock.capture(capturedMpId))).andReturn(job1);
  EasyMock.expect(serviceRegistry.getJob(1L)).andReturn(job1).anyTimes();
  Job job2 = createJob(2L, "anything", "anything");
  EasyMock.expect(downloadDistributionService.retract(EasyMock.anyString(), EasyMock.anyObject(MediaPackage.class),
          EasyMock.anyObject(Set.class))).andReturn(job2);
  EasyMock.expect(serviceRegistry.getJob(2L)).andReturn(job2).anyTimes();
  replayServices();
  service.setDownloadDistributionService(downloadDistributionService);
  service.retract(mp);
  Assert.assertEquals(MP_ID, capturedMpId.getValue());
  EasyMock.verify(searchService, downloadDistributionService);
}