EndpointStarter { public void start() { endpointStopperCounterpart.setCounter(0); String groovyCommand = endpointStopperCounterpart.getEndpointNeedToStop() + ".start()"; busController.send(groovyCommand); Notification notification = new Notification(); notification.setDetails(groovyCommand + " was called."); notification.setSubject("The endpoint of si-c2s-xds was started"); notificationPublisher.publish(notification); }  void setEndpointStopperCounterpart(
			EndpointStopper endpointStopperCounterpart); void start();  }
@Test public void testStart_BusController_Is_Sent_StartCommand() { final String endpointNeedToStop = "EndpointNeedToStop"; when(endpointStopperCounterpart.getEndpointNeedToStop()).thenReturn(endpointNeedToStop); sut.start(); String expectedCommand = endpointNeedToStop + ".start()"; verify(busController, times(1)).send(expectedCommand); }
@Test public void testStart_Notification_Is_Published() { final String endpointNeedToStop = "EndpointNeedToStop"; when(endpointStopperCounterpart.getEndpointNeedToStop()).thenReturn(endpointNeedToStop); sut.start(); String expectedDetails = endpointNeedToStop + ".start()" + " was called."; String expectedSubject = "The endpoint of si-c2s-xds was started"; verify(notificationPublisher, times(1)).publish(argThat(new IsNotificationAsExpected(expectedSubject, expectedDetails))); }
@Test public void testStart_EndpointStopperCounterpart_Is_SetCounter_To_Zero() { sut.start(); verify(endpointStopperCounterpart, times(1)).setCounter(0); }