use of uk.gov.justice.services.generators.commons.config.CommonGeneratorProperties in project microservice_framework by CJSCommonPlatform.
the class RestAdapterGenerator_PATCHMethodBodyTest method shouldReturnResponseGeneratedByRestProcessor.
@Test
@SuppressWarnings("unchecked")
public void shouldReturnResponseGeneratedByRestProcessor() throws Exception {
generator.run(restRamlWithCommandApiDefaults().with(resource("/path").with(httpActionWithDefaultMapping(PATCH).withHttpActionOfDefaultRequestType())).build(), configurationWithBasePackage(BASE_PACKAGE, outputFolder, new CommonGeneratorProperties()));
final Class<?> resourceClass = compiler.compiledClassOf(BASE_PACKAGE, "resource", "DefaultCommandApiPathResource");
final Object resourceObject = getInstanceOf(resourceClass);
final Response processorResponse = Response.ok().build();
when(restProcessor.process(anyString(), any(Function.class), anyString(), any(Optional.class), any(HttpHeaders.class), any(Collection.class))).thenReturn(processorResponse);
final Method method = firstMethodOf(resourceClass).get();
final Object result = method.invoke(resourceObject, NOT_USED_JSONOBJECT);
assertThat(result, is(processorResponse));
}
Aggregations