use of uk.gov.justice.services.generators.test.utils.builder.MappingBuilder in project microservice_framework by CJSCommonPlatform.
the class NamesTest method shouldBuildResourceMethodNameFromActionAndMimeType.
@Test
public void shouldBuildResourceMethodNameFromActionAndMimeType() throws Exception {
final MappingBuilder mappingBuilder = mapping().withName("command.create-user").withRequestType("application/vnd.command.create-user+json");
final Action action = httpAction().withHttpActionType(POST).withDescription(mappingDescriptionWith(mappingBuilder).build()).build();
action.setResource(resource().withRelativeUri("test").build());
final String shortMimeType = Names.resourceMethodNameFrom(action, new MimeType("application/vnd.command.create-user+json"));
assertThat(shortMimeType, is("postCommandCreateUserTest"));
}
use of uk.gov.justice.services.generators.test.utils.builder.MappingBuilder in project microservice_framework by CJSCommonPlatform.
the class NamesTest method shouldBuildResourceMethodNameFromAction.
@Test
public void shouldBuildResourceMethodNameFromAction() throws Exception {
final MappingBuilder mappingBuilder = mapping().withName("command.create-user").withRequestType("application/vnd.command.create-user+json");
final Action action = httpAction().withHttpActionType(GET).withDescription(mappingDescriptionWith(mappingBuilder).build()).build();
action.setResource(resource().withRelativeUri("test").build());
final String shortMimeType = Names.resourceMethodNameWithNoMimeTypeFrom(action);
assertThat(shortMimeType, is("getTest"));
}
use of uk.gov.justice.services.generators.test.utils.builder.MappingBuilder in project microservice_framework by CJSCommonPlatform.
the class NamesTest method shouldBuildResourceMethodNameFromActionAndNullMimeType.
@Test
public void shouldBuildResourceMethodNameFromActionAndNullMimeType() throws Exception {
final MappingBuilder mappingBuilder = mapping().withName("command.create-user").withRequestType("application/vnd.command.create-user+json");
final Action action = httpAction().withHttpActionType(POST).withDescription(mappingDescriptionWith(mappingBuilder).build()).build();
action.setResource(resource().withRelativeUri("test").build());
final String shortMimeType = Names.resourceMethodNameFrom(action, null);
assertThat(shortMimeType, is("postTest"));
}
Aggregations