use of com.arbindo.mimock.entities.TextualResponse in project mimock by arbindo.
the class ResponseFactoryExecutorTest method shouldReturnImplementationForTextualResponse.
@Test
void shouldReturnImplementationForTextualResponse() {
TextualResponse textualResponse = TextualResponse.builder().responseBody("{'message': 'Hello World!'}").build();
Mock textualResponseMock = Mock.builder().textualResponse(textualResponse).binaryResponse(null).build();
ResponseFactory responseFactory = responseFactoryExecutor.responseFactory(textualResponseMock);
assertEquals(TextualResponseImpl.class, responseFactory.getClass());
assertEquals(textualResponse.getResponseBody(), responseFactory.responseBody());
}
use of com.arbindo.mimock.entities.TextualResponse in project mimock by arbindo.
the class DomainModelMapperTest method shouldReturnModelWithTextResponseFactory.
@Test
void shouldReturnModelWithTextResponseFactory() {
ResponseContentType responseContentType = ResponseContentType.builder().contentType("application/json").build();
TextualResponse textualResponse = TextualResponse.builder().responseBody("{'message': 'Hello World!'}").build();
Mock testMock = Mock.builder().responseContentType(responseContentType).statusCode(200).textualResponse(textualResponse).binaryResponse(null).build();
DomainModelForMock mappedModel = domainModelMapper.mappedModel(testMock);
assertEquals("{'message': 'Hello World!'}", mappedModel.getResponseBody());
assertEquals(200, mappedModel.getStatusCode());
assertEquals("application/json", mappedModel.getResponseContentType());
assertEquals(TypeOfResponse.TEXTUAL_RESPONSE, mappedModel.getTypeOfResponse());
}
use of com.arbindo.mimock.entities.TextualResponse in project mimock by arbindo.
the class DomainModelMapperTest method shouldReturnModelWithTextResponseFactoryWhenResponseHeaderIsNotNull.
@Test
void shouldReturnModelWithTextResponseFactoryWhenResponseHeaderIsNotNull() {
ResponseContentType responseContentType = ResponseContentType.builder().contentType("application/json").build();
TextualResponse textualResponse = TextualResponse.builder().responseBody("{'message': 'Hello World!'}").build();
Mock testMock = Mock.builder().responseContentType(responseContentType).statusCode(200).textualResponse(textualResponse).responseHeaders(MocksGenerator.generateResponseHeader()).binaryResponse(null).build();
DomainModelForMock mappedModel = domainModelMapper.mappedModel(testMock);
assertEquals("{'message': 'Hello World!'}", mappedModel.getResponseBody());
assertEquals(200, mappedModel.getStatusCode());
assertEquals("application/json", mappedModel.getResponseContentType());
assertEquals(TypeOfResponse.TEXTUAL_RESPONSE, mappedModel.getTypeOfResponse());
assertNotNull(mappedModel.getResponseHeaders());
}
use of com.arbindo.mimock.entities.TextualResponse in project mimock by arbindo.
the class DomainModelMapperTest method shouldReturnModelWithTextResponseFactoryWhenResponseContentTypeIsNull.
@Test
void shouldReturnModelWithTextResponseFactoryWhenResponseContentTypeIsNull() {
TextualResponse textualResponse = TextualResponse.builder().responseBody("{'message': 'Hello World!'}").build();
Mock testMock = Mock.builder().statusCode(200).textualResponse(textualResponse).responseHeaders(MocksGenerator.generateResponseHeader()).binaryResponse(null).build();
DomainModelForMock mappedModel = domainModelMapper.mappedModel(testMock);
assertEquals("{'message': 'Hello World!'}", mappedModel.getResponseBody());
assertEquals(200, mappedModel.getStatusCode());
assertEquals(TypeOfResponse.TEXTUAL_RESPONSE, mappedModel.getTypeOfResponse());
assertNotNull(mappedModel.getResponseHeaders());
}
use of com.arbindo.mimock.entities.TextualResponse in project mimock by neel1996.
the class ResponseFactoryExecutorTest method shouldReturnImplementationForTextualResponse.
@Test
void shouldReturnImplementationForTextualResponse() {
TextualResponse textualResponse = TextualResponse.builder().responseBody("{'message': 'Hello World!'}").build();
Mock textualResponseMock = Mock.builder().textualResponse(textualResponse).binaryResponse(null).build();
ResponseFactory responseFactory = responseFactoryExecutor.responseFactory(textualResponseMock);
assertEquals(TextualResponseImpl.class, responseFactory.getClass());
assertEquals(textualResponse.getResponseBody(), responseFactory.responseBody());
}
Aggregations