### Question:
EventSchedulerService extends EventSchedulerGrpc.EventSchedulerImplBase implements
        AxonServerClientService { @Override public void rescheduleEvent(RescheduleEventRequest request, StreamObserver<ScheduleToken> responseObserver) { if (!request.getToken().equals("")) { standaloneTaskManager.cancel(request.getToken()); } doScheduleEvent(request.getEvent(), request.getInstant(), responseObserver); } EventSchedulerService(StandaloneTaskManager standaloneTaskManager,
                                 TaskPayloadSerializer taskPayloadSerializer); @Override void scheduleEvent(ScheduleEventRequest request, StreamObserver<ScheduleToken> responseObserver); @Override void rescheduleEvent(RescheduleEventRequest request,
                                StreamObserver<ScheduleToken> responseObserver); @Override void cancelScheduledEvent(CancelScheduledEventRequest request,
                                     StreamObserver<InstructionAck> responseObserver);  }### Answer:
@Test public void rescheduleEventWithoutPreviousToken() { FakeStreamObserver<ScheduleToken> responseObserver = new FakeStreamObserver<>(); RescheduleEventRequest request = RescheduleEventRequest.getDefaultInstance(); testSubject.rescheduleEvent(request, responseObserver); assertFalse(responseObserver.values().isEmpty()); ScheduleToken scheduleToken = responseObserver.values().get(0); assertEquals("1234", scheduleToken.getToken()); verify(standaloneTaskManager, never()).cancel(anyString()); assertEquals(1, responseObserver.completedCount()); }
@Test public void rescheduleEventWithPreviousToken() { FakeStreamObserver<ScheduleToken> responseObserver = new FakeStreamObserver<>(); RescheduleEventRequest request = RescheduleEventRequest.newBuilder() .setToken("123") .build(); testSubject.rescheduleEvent(request, responseObserver); assertFalse(responseObserver.values().isEmpty()); ScheduleToken scheduleToken = responseObserver.values().get(0); assertEquals("1234", scheduleToken.getToken()); verify(standaloneTaskManager).cancel("123"); assertEquals(1, responseObserver.completedCount()); }