@Test(expected = IllegalArgumentException.class) public void roadDoesNotExist() { store.clear(); underTest.schema("road1", 1); }
public Schema schema(String roadName, int version) { return Mono .justOrEmpty(store.get(roadName)) .switchIfEmpty(throwRoadDoesNotExist(roadName)) .map(Road::getSchemas) .flatMap(schemas -> Mono.justOrEmpty(schemas.get(version))) .switchIfEmpty(throwSchemaDoesNotExist(roadName, version)) .map(SchemaVersion::getSchema) .block(); }
SchemaProvider { public Schema schema(String roadName, int version) { return Mono .justOrEmpty(store.get(roadName)) .switchIfEmpty(throwRoadDoesNotExist(roadName)) .map(Road::getSchemas) .flatMap(schemas -> Mono.justOrEmpty(schemas.get(version))) .switchIfEmpty(throwSchemaDoesNotExist(roadName, version)) .map(SchemaVersion::getSchema) .block(); } }
SchemaProvider { public Schema schema(String roadName, int version) { return Mono .justOrEmpty(store.get(roadName)) .switchIfEmpty(throwRoadDoesNotExist(roadName)) .map(Road::getSchemas) .flatMap(schemas -> Mono.justOrEmpty(schemas.get(version))) .switchIfEmpty(throwSchemaDoesNotExist(roadName, version)) .map(SchemaVersion::getSchema) .block(); }  }
SchemaProvider { public Schema schema(String roadName, int version) { return Mono .justOrEmpty(store.get(roadName)) .switchIfEmpty(throwRoadDoesNotExist(roadName)) .map(Road::getSchemas) .flatMap(schemas -> Mono.justOrEmpty(schemas.get(version))) .switchIfEmpty(throwSchemaDoesNotExist(roadName, version)) .map(SchemaVersion::getSchema) .block(); }  Schema schema(String roadName, int version); }
SchemaProvider { public Schema schema(String roadName, int version) { return Mono .justOrEmpty(store.get(roadName)) .switchIfEmpty(throwRoadDoesNotExist(roadName)) .map(Road::getSchemas) .flatMap(schemas -> Mono.justOrEmpty(schemas.get(version))) .switchIfEmpty(throwSchemaDoesNotExist(roadName, version)) .map(SchemaVersion::getSchema) .block(); }  Schema schema(String roadName, int version);  }