Search in sources :

Example 1 with ActionMimeTypeDefinition

use of uk.gov.justice.services.generators.commons.client.ActionMimeTypeDefinition in project microservice_framework by CJSCommonPlatform.

the class NamesTest method shouldGenerateCorrectResourceNameForPostWithRequestMimeType.

@Test
public void shouldGenerateCorrectResourceNameForPostWithRequestMimeType() {
    final Action action = HttpActionBuilder.defaultPostAction().withResourceUri("/some/path/{recipeId}/").build();
    final ActionMimeTypeDefinition actionMimeTypeDefinition = ActionMimeTypeDefinition.definitionWithRequest(new MimeType("application/vnd.command.create-user+json"));
    assertThat(Names.buildResourceMethodNameFromVerbUriAndMimeType(action, actionMimeTypeDefinition), equalTo("postSomePathRecipeIdCommandCreateUser"));
}
Also used : ActionMimeTypeDefinition(uk.gov.justice.services.generators.commons.client.ActionMimeTypeDefinition) HttpActionBuilder.httpAction(uk.gov.justice.services.generators.test.utils.builder.HttpActionBuilder.httpAction) Action(org.raml.model.Action) MimeType(org.raml.model.MimeType) Test(org.junit.Test)

Example 2 with ActionMimeTypeDefinition

use of uk.gov.justice.services.generators.commons.client.ActionMimeTypeDefinition in project microservice_framework by CJSCommonPlatform.

the class NamesTest method shouldGenerateCorrectResourceNameForGetWithResponseMimeType.

@Test
public void shouldGenerateCorrectResourceNameForGetWithResponseMimeType() {
    final Action action = HttpActionBuilder.defaultGetAction().withResourceUri("/some/path/{recipeId}/").build();
    final ActionMimeTypeDefinition actionMimeTypeDefinition = ActionMimeTypeDefinition.definitionWithResponse(new MimeType("application/vnd.command.create-user+json"));
    assertThat(Names.buildResourceMethodNameFromVerbUriAndMimeType(action, actionMimeTypeDefinition), equalTo("getSomePathRecipeIdCommandCreateUser"));
}
Also used : ActionMimeTypeDefinition(uk.gov.justice.services.generators.commons.client.ActionMimeTypeDefinition) HttpActionBuilder.httpAction(uk.gov.justice.services.generators.test.utils.builder.HttpActionBuilder.httpAction) Action(org.raml.model.Action) MimeType(org.raml.model.MimeType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Action (org.raml.model.Action)2 MimeType (org.raml.model.MimeType)2 ActionMimeTypeDefinition (uk.gov.justice.services.generators.commons.client.ActionMimeTypeDefinition)2 HttpActionBuilder.httpAction (uk.gov.justice.services.generators.test.utils.builder.HttpActionBuilder.httpAction)2