@Test(expected = OrchidException.class)
 public void shouldThrowErrorWhenFaildConvertURL() throws CMException, OrchidException {
   doReturn(policyCMServer).when(target).getCmServer();
   when(video.getThumbnailUrl()).thenReturn("wrong.url");
   SyncEventListener sync = target.new SyncEventListener();
   sync.processEvent(oc, oe);
 }
 @Test
 public void shouldNotCallBrightcoveServiceIfBrightcoveIdIsEmpty()
     throws OrchidException, CMException, BrightcoveException {
   when(policy.getId()).thenReturn("");
   SyncEventListener sync = target.new SyncEventListener();
   sync.processEvent(oc, oe);
   verify(brightcoveService, never()).findByVideoID(anyLong());
 }
 @Test
 public void shouldNotAddImageIfThumbnailIsBlank()
     throws OrchidException, IOException, CMException {
   doReturn(policyCMServer).when(target).getCmServer();
   when(video.getThumbnailUrl()).thenReturn(null);
   SyncEventListener sync = target.new SyncEventListener();
   sync.processEvent(oc, oe);
   verify(policy, never()).getChildPolicy("imageType");
 }
 @Test(expected = OrchidException.class)
 public void shouldShowErrorWhenFailedToFindVieo()
     throws CMException, BrightcoveException, OrchidException {
   doThrow(new BrightcoveException("Unit test generated Exception"))
       .when(brightcoveService)
       .findByVideoID(1);
   SyncEventListener sync = target.new SyncEventListener();
   try {
     sync.processEvent(oc, oe);
   } catch (OrchidException e) {
     verify(target, times(1)).handleErrors(eq(oc), anyString());
     throw e;
   }
 }
 @Test
 public void shouldSuccessfullySyncVideo() throws CMException, OrchidException {
   doReturn(policyCMServer).when(target).getCmServer();
   SyncEventListener sync = target.new SyncEventListener();
   sync.processEvent(oc, oe);
 }
 @Test(expected = OrchidException.class)
 public void shouldThrowErrorWhenFaildToStore() throws CMException, OrchidException {
   doThrow(new CMException("Unit test generated Exception")).when(policyWidget).store();
   SyncEventListener sync = target.new SyncEventListener();
   sync.processEvent(oc, oe);
 }