@Test(expected = NotificationException.class) public void testRejectRequest() throws SystemException, PortalException, NotificationException { // Given Mockito.doThrow(new SystemException()).when(socialRelationService).rejectRequest(anyLong()); // When notificationService.rejectRequest(23353L); }