use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class ActionMimeTypeDefinitionTest method shouldCreateWithRequestTypeAndResponseTypeAndAndReturnResponseTypeAsResponseType.
@Test
public void shouldCreateWithRequestTypeAndResponseTypeAndAndReturnResponseTypeAsResponseType() throws Exception {
final MimeType requestType = mock(MimeType.class);
final MimeType responseType = mock(MimeType.class);
assertThat(definitionWithRequestAndResponse(requestType, responseType).getResponseType(), sameInstance(responseType));
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class ActionMimeTypeDefinitionTest method shouldCreateWithRequestTypeAndResponseTypeAndReturnRequestTypeAsNameType.
@Test
public void shouldCreateWithRequestTypeAndResponseTypeAndReturnRequestTypeAsNameType() throws Exception {
final MimeType requestType = mock(MimeType.class);
final MimeType responseType = mock(MimeType.class);
assertThat(definitionWithRequestAndResponse(requestType, responseType).getNameType(), sameInstance(requestType));
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class ActionMimeTypeDefinitionTest method shouldCreateWithRequestTypeAndReturnRequestTypeAsResponeType.
@Test
public void shouldCreateWithRequestTypeAndReturnRequestTypeAsResponeType() throws Exception {
final MimeType mimeType = mock(MimeType.class);
assertThat(definitionWithRequest(mimeType).getResponseType(), sameInstance(mimeType));
}
use of org.raml.model.MimeType 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"));
}
use of org.raml.model.MimeType in project microservice_framework by CJSCommonPlatform.
the class NamesTest method shouldBuildResourceMethodNameFromActionIfNoMapping.
@Test
public void shouldBuildResourceMethodNameFromActionIfNoMapping() throws Exception {
final Action action = httpAction().withHttpActionType(POST).build();
action.setResource(resource().withRelativeUri("test").build());
final String shortMimeType = Names.resourceMethodNameFrom(action, new MimeType("application/vnd.command.create-user+json"));
assertThat(shortMimeType, is("postTest"));
}
Aggregations