### Question:
ConfigurableProducer { @Produces @Configurable String getConfigurationPropertyAsString(InjectionPoint injectionPoint) { ConfigurationProperty configProp = injectionPoint.getAnnotated().getAnnotation(ConfigurationProperty.class); if (configProp == null) { String message = "Any field or parameter annotated with @" + Configurable.class.getSimpleName() + " must also be annotated with @" + ConfigurationProperty.class.getSimpleName(); throw new IllegalArgumentException(message); } return effectiveConfig.get(configProp.value()); }    }### Answer:
@Test public void shouldThrowIllegalArgumentExceptionIfAnnotationIsMissing() throws Exception { Annotated annotated = mock(Annotated.class); when(annotated.getAnnotation(eq(ConfigurationProperty.class))).thenReturn(null); InjectionPoint injectionPoint = mock(InjectionPoint.class); when(injectionPoint.getAnnotated()).thenReturn(annotated); expectedException.expect(IllegalArgumentException.class); String message = "Any field or parameter annotated with @Configurable " + "must also be annotated with @ConfigurationProperty"; expectedException.expectMessage(message); configurableProducer.getConfigurationPropertyAsString(injectionPoint); }