Search in sources :

Example 1 with DELETE

use of org.raml.model.ActionType.DELETE in project microservice_framework by CJSCommonPlatform.

the class RestAdapterGenerator_CodeStructureTest method shouldGenerateResourceInterfaceWithOneDELETEMethod.

@Test
public void shouldGenerateResourceInterfaceWithOneDELETEMethod() throws Exception {
    generator.run(restRamlWithDefaults().with(resource("/some/path").with(httpActionWithDefaultMapping(DELETE, "application/vnd.default+json").with(mapping().withName("blah").withRequestType("application/vnd.default+json")))).build(), configurationWithBasePackage(BASE_PACKAGE, outputFolder, new CommonGeneratorProperties()));
    final Class<?> interfaceClass = compiler.compiledInterfaceOf(RESOURCE_PACKAGE);
    final List<Method> methods = methodsOf(interfaceClass);
    assertThat(methods, hasSize(1));
    final Method method = methods.get(0);
    assertThat(method.getReturnType(), equalTo(Response.class));
    assertThat(method.getAnnotation(DELETE.class), not(nullValue()));
    assertThat(method.getAnnotation(Consumes.class), not(nullValue()));
    assertThat(method.getAnnotation(Consumes.class).value(), is(new String[] { "application/vnd.default+json" }));
}
Also used : Response(javax.ws.rs.core.Response) DELETE(javax.ws.rs.DELETE) DELETE(org.raml.model.ActionType.DELETE) Consumes(javax.ws.rs.Consumes) CommonGeneratorProperties(uk.gov.justice.services.generators.commons.config.CommonGeneratorProperties) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Consumes (javax.ws.rs.Consumes)1 DELETE (javax.ws.rs.DELETE)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1 DELETE (org.raml.model.ActionType.DELETE)1 CommonGeneratorProperties (uk.gov.justice.services.generators.commons.config.CommonGeneratorProperties)1