コード例 #1
0
 @Test
 public void testStartRuntimeException() throws ProfileActionException {
   doThrow(new RuntimeException()).when(mapper).run();
   mapperProfile.start(executorService);
   verify(mapper).run();
   verify(mutableProfileStatus).setProfileState(ProfileState.FINISHED_ERRORS);
 }
コード例 #2
0
 @Test
 public void testStart() throws ProfileActionException {
   mapperProfile.start(executorService);
   verify(mapper).run();
   verify(mutableProfileStatus).setProfileState(ProfileState.FINISHED_SUCCESSFULLY);
   verify(mutableProfileStatus).setStatusMessages(eq(new ArrayList<ProfileStatusMessage>()));
 }
コード例 #3
0
 @Test
 public void testStartProfileActionException() throws ProfileActionException {
   ProfileActionException profileActionException = mock(ProfileActionException.class);
   ProfileStatusMessage message = mock(ProfileStatusMessage.class);
   when(profileActionException.getProfileStatusMessage()).thenReturn(message);
   doThrow(profileActionException).when(mapper).run();
   mapperProfile.start(executorService);
   verify(mapper).run();
   verify(mutableProfileStatus).setProfileState(ProfileState.FINISHED_ERRORS);
   ArgumentCaptor<ProfileActionExceptionWrapper> captor =
       ArgumentCaptor.forClass(ProfileActionExceptionWrapper.class);
   verify(mutableProfileStatus).setOperationError(captor.capture());
   assertEquals(message, captor.getValue().getMessage());
 }