use of uk.gov.justice.services.adapter.rest.multipart.FileInputDetailsFactory in project microservice_framework by CJSCommonPlatform.
the class RestAdapterGenerator_MultipartCodeStructureTest method shouldGenerateResourceClassWithInjectedFileInputDetailsFactory.
@Test
public void shouldGenerateResourceClassWithInjectedFileInputDetailsFactory() throws Exception {
generator.run(restRamlWithCommandApiDefaults().with(resource("/some/path").with(httpAction().withHttpActionType(POST).withMediaTypeWithoutSchema(multipartWithFileFormParameter("photoId")).with(mapping().withName("upload").withRequestType(MULTIPART_FORM_DATA)))).build(), configurationWithBasePackage(BASE_PACKAGE, outputFolder, new CommonGeneratorProperties()));
final Class<?> resourceClass = compiler.compiledClassOf(BASE_PACKAGE, "resource", "DefaultCommandApiSomePathResource");
final Field chainProcess = resourceClass.getDeclaredField("fileInputDetailsFactory");
assertThat(chainProcess, not(nullValue()));
assertThat(chainProcess.getType(), equalTo(FileInputDetailsFactory.class));
assertThat(chainProcess.getAnnotation(Inject.class), not(nullValue()));
assertThat(chainProcess.getModifiers(), is(0));
}
Aggregations