@Test
public void shouldFallBackToFileBasedSchemaValidationIfNoSchemaFoundInTheCatalogCache() throws Exception {

    final String uri = "http://space.time.gov.uk/mind/command/api/initiate-warp-speed.json";
    final String actionName = "command.api.initiate-warp-speed";
    final Optional<String> schemaId = of(uri);
    final MediaType mediaType = new MediaType("application", "vnd.mind.command.initiate-warp-speed+json");
    final String envelopeJson = "{\"envelope\": \"json\"}";
    when(schemaIdMappingCache.schemaIdFor(mediaType)).thenReturn(schemaId);
    when(schemaCatalogService.findSchema(uri)).thenReturn(empty());
    schemaCatalogAwareJsonSchemaValidator.validate(envelopeJson, actionName, of(mediaType));
    verify(fileBasedJsonSchemaValidator).validateWithoutSchemaCatalog(envelopeJson, actionName);
    verifyZeroInteractions(payloadExtractor);
}