RoadSchemaNotificationHandler { public void handleRoadCreated(Road road) { notificationHandler.send(RoadCreatedNotification .builder() .roadName(road.getName()) .contactEmail(road.getContactEmail()) .description(road.getDescription()) .teamName(road.getTeamName()) .build()); }  void handleRoadCreated(Road road); void handleSchemaCreated(String roadName, int schemaVersion); void handleSchemaDeleted(String roadName, int schemaVersion);  }
@Test public void roadCreated() throws Exception { Road road = new Road(); road.setName(ROAD_NAME); road.setContactEmail(EMAIL); road.setDescription(DESCRIPTION); road.setTeamName(TEAM_NAME); underTest.handleRoadCreated(road); ArgumentCaptor<DataHighwayNotification> captor = ArgumentCaptor.forClass(DataHighwayNotification.class); verify(notificationHandler).send(captor.capture()); RoadCreatedNotification notification = (RoadCreatedNotification) captor.getValue(); assertThat(notification.getType(), is(RoadNotificationType.ROAD_CREATED)); assertThat(notification.getRoadName(), is(ROAD_NAME)); assertThat(notification.getContactEmail(), is(EMAIL)); assertThat(notification.getDescription(), is(DESCRIPTION)); assertThat(notification.getTeamName(), is(TEAM_NAME)); }