RoadSchemaNotificationHandler { public void handleSchemaDeleted(String roadName, int schemaVersion) { SchemaVersionDeleted schemaNotification = SchemaVersionDeleted .builder() .roadName(roadName) .schemaVersion(schemaVersion) .build(); notificationHandler.send(schemaNotification); }  void handleRoadCreated(Road road); void handleSchemaCreated(String roadName, int schemaVersion); void handleSchemaDeleted(String roadName, int schemaVersion);  }
@Test public void schemaDeleted() throws Exception { underTest.handleSchemaDeleted(ROAD_NAME, SCHEMA_VERSION); ArgumentCaptor<DataHighwayNotification> captor = ArgumentCaptor.forClass(DataHighwayNotification.class); verify(notificationHandler).send(captor.capture()); SchemaVersionDeleted notification = (SchemaVersionDeleted) captor.getValue(); assertThat(notification.getSchemaVersion(), is(SCHEMA_VERSION)); assertThat(notification.getType(), is(RoadNotificationType.SCHEMA_VERSION_DELETED)); }