コード例 #1
0
 @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);
 }
コード例 #2
0
 @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());
 }
コード例 #3
0
 @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");
 }
コード例 #4
0
 @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;
   }
 }
コード例 #5
0
 @Test
 public void shouldSuccessfullySyncVideo() throws CMException, OrchidException {
   doReturn(policyCMServer).when(target).getCmServer();
   SyncEventListener sync = target.new SyncEventListener();
   sync.processEvent(oc, oe);
 }
コード例 #6
0
 @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);
 }