@Test
public void shouldInitialiseTheCacheOnlyOnce() throws Exception {

    final MediaType mediaType = new MediaType("application/vnd.example.add-recipe+json");
    final String schemaId = "http://justice.gov.uk/example/command/api/example.add-recipe.json";
    final Map<MediaType, String> mediaTypeToSchemaIdMap = of(mediaType, schemaId);
    when(schemaIdMappingCacheInitialiser.initialiseCache()).thenReturn(mediaTypeToSchemaIdMap);
    assertThat(defaultSchemaIdMappingCache.schemaIdFor(mediaType).get(), is(schemaId));
    assertThat(defaultSchemaIdMappingCache.schemaIdFor(mediaType).get(), is(schemaId));
    assertThat(defaultSchemaIdMappingCache.schemaIdFor(mediaType).get(), is(schemaId));
    assertThat(defaultSchemaIdMappingCache.schemaIdFor(mediaType).get(), is(schemaId));
    assertThat(defaultSchemaIdMappingCache.schemaIdFor(mediaType).get(), is(schemaId));
    assertThat(defaultSchemaIdMappingCache.schemaIdFor(mediaType).get(), is(schemaId));
    verify(schemaIdMappingCacheInitialiser, times(1)).initialiseCache();
}