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