Search in sources :

Example 1 with RestProcessor

use of uk.gov.justice.services.adapter.rest.processor.RestProcessor in project microservice_framework by CJSCommonPlatform.

the class RestAdapterGenerator_CodeStructureTest method shouldAddAnnotatedRestProcessorProperty.

@Test
public void shouldAddAnnotatedRestProcessorProperty() throws Exception {
    generator.run(restRamlWithCommandApiDefaults().with(defaultPostResource().withRelativeUri("/some/path")).build(), configurationWithBasePackage(BASE_PACKAGE, outputFolder, new CommonGeneratorProperties()));
    final Class<?> resourceClass = compiler.compiledClassOf(BASE_PACKAGE, "resource", "DefaultCommandApiSomePathResource");
    final Field dispatcher = resourceClass.getDeclaredField("restProcessor");
    assertThat(dispatcher, not(nullValue()));
    assertThat(dispatcher.getType(), equalTo(RestProcessor.class));
    assertThat(dispatcher.getAnnotation(Inject.class), not(nullValue()));
    assertThat(dispatcher.getModifiers(), is(0));
}
Also used : Inject(javax.inject.Inject) Field(java.lang.reflect.Field) CommonGeneratorProperties(uk.gov.justice.services.generators.commons.config.CommonGeneratorProperties) RestProcessor(uk.gov.justice.services.adapter.rest.processor.RestProcessor) Test(org.junit.Test)

Aggregations

Field (java.lang.reflect.Field)1 Inject (javax.inject.Inject)1 Test (org.junit.Test)1 RestProcessor (uk.gov.justice.services.adapter.rest.processor.RestProcessor)1 CommonGeneratorProperties (uk.gov.justice.services.generators.commons.config.CommonGeneratorProperties)1