### Question:
BadgeClassActor extends BaseActor { private void searchBadgeClass(Request actorMessage) { ProjectLogger.log("searchBadgeClass called"); try { Response response = badgingService.searchBadgeClass(actorMessage); sender().tell(response, self()); } catch (ProjectCommonException e) { ProjectLogger.log("searchBadgeClass: exception = ", e); sender().tell(e, self()); } } BadgeClassActor();  BadgeClassActor(BadgingService badgingService); @Override void onReceive(Request request);  }### Answer:
@Test public void testSearchBadgeClassSuccess() { PowerMockito.when(mockBadgingService.searchBadgeClass(actorMessage)).thenReturn(new Response()); actorMessage.setOperation(BadgingActorOperations.SEARCH_BADGE_CLASS.getValue()); subject.tell(actorMessage, probe.getRef()); Response response = probe.expectMsgClass(ACTOR_MAX_WAIT_DURATION, Response.class); Assert.assertTrue(null != response); }
@Test public void testSearchBadgeClassFailure() { PowerMockito.when(mockBadgingService.searchBadgeClass(actorMessage)) .thenThrow(resourceNotFoundException); actorMessage.setOperation(BadgingActorOperations.SEARCH_BADGE_CLASS.getValue()); subject.tell(actorMessage, probe.getRef()); ProjectCommonException exception = probe.expectMsgClass(ACTOR_MAX_WAIT_DURATION, ProjectCommonException.class); Assert.assertTrue(null != exception); }