@SuppressWarnings("unchecked")
@Test
public void shouldInitialiseTheMappingCache() throws Exception {

    final String actionName = "example.add-recipe";
    final MediaType requestMediaType = new MediaType("application/vnd.example.add-recipe+json");
    final MediaType responseMediaType = new MediaType("application/vnd.example.recipe-added+json");
    final Map<String, MediaTypes> mediaTypeToSchemaIdMap = of(actionName, new MediaTypes(requestMediaType, responseMediaType));
    final Bean<ActionNameToMediaTypesMapper> bean_1 = mock(Bean.class);
    final ActionNameToMediaTypesMapper actionNameToMediaTypesMapper = mock(ActionNameToMediaTypesMapper.class);
    when(actionNameToMediaTypesMappingObserver.getNameMediaTypesMappers()).thenReturn(singletonList(bean_1));
    when(beanInstantiater.instantiate(bean_1)).thenReturn(actionNameToMediaTypesMapper);
    when(actionNameToMediaTypesMapper.getActionNameToMediaTypesMap()).thenReturn(mediaTypeToSchemaIdMap);
    final Map<String, MediaTypes> mappingCache = mediaTypesMappingCacheInitialiser.initialiseCache();
    final MediaTypes mediaTypes = mappingCache.get(actionName);
    assertThat(mediaTypes.getRequestMediaType().get(), is(requestMediaType));
    assertThat(mediaTypes.getResponseMediaType().get(), is(responseMediaType));
}