@Test
public void shouldFailIfTheBeanAnnotatedWithSchemaIdMapperIsNotAnInstanceOfMediaTypeToSchemaIdMapper() throws Exception {

    final BeanManager beanManager = mock(BeanManager.class);
    final AfterDeploymentValidation event = mock(AfterDeploymentValidation.class);
    final Bean bean_1 = mock(Bean.class);
    final Set<Bean<?>> beans = new HashSet<>();
    beans.add(bean_1);
    when(beanManager.getBeans(eq(Object.class), any(AnnotationLiteral.class))).thenReturn(beans);
    when(bean_1.getBeanClass()).thenReturn(DodgySchemaIdMapper.class);
    try {
        schemaIdMappingObserver.afterDeploymentValidation(event, beanManager);
        fail();
    } catch (final BadSchemaIdMapperAnnotationException expected) {
        assertThat(expected.getMessage(), is(
                "Class 'uk.gov.justice.services.core.mapping.SchemaIdMappingObserverTest$DodgySchemaIdMapper' " +
                        "annotated with @SchemaIdMapper " +
                        "should implement the 'uk.gov.justice.services.core.mapping.MediaTypeToSchemaIdMapper' interface"));
    }
}