Search in sources :

Example 31 with ResponseContentType

use of com.arbindo.mimock.entities.ResponseContentType in project mimock by neel1996.

the class ResponseContentTypesRepositoryTest method shouldReturnNullForInvalidAudioType.

@ParameterizedTest
@ValueSource(strings = { "audio/x-ms-wma", "audio/vnd.rn-realaudio", "audio/x-wav" })
void shouldReturnNullForInvalidAudioType(String audioResponseType) {
    // Act
    ResponseContentType responseType = responseContentTypesRepository.findByContentType(audioResponseType);
    // Assert
    assertNull(responseType);
}
Also used : ResponseContentType(com.arbindo.mimock.entities.ResponseContentType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 32 with ResponseContentType

use of com.arbindo.mimock.entities.ResponseContentType in project mimock by neel1996.

the class ResponseContentTypesRepositoryTest method shouldReturnNullForInvalidImageType.

@ParameterizedTest
@ValueSource(strings = { "image/vnd.microsoft.icon ", "image/x-icon", "image/vnd.djvu" })
void shouldReturnNullForInvalidImageType(String imageResponseType) {
    // Act
    ResponseContentType responseType = responseContentTypesRepository.findByContentType(imageResponseType);
    // Assert
    assertNull(responseType);
}
Also used : ResponseContentType(com.arbindo.mimock.entities.ResponseContentType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 33 with ResponseContentType

use of com.arbindo.mimock.entities.ResponseContentType in project mimock by neel1996.

the class ResponseContentTypesRepositoryTest method shouldReturnResponseContentTypeForValidVideoType.

@ParameterizedTest
@ValueSource(strings = { "video/mpeg", "video/mp4", "video/x-msvideo", "video/webm" })
void shouldReturnResponseContentTypeForValidVideoType(String videoResponseType) {
    // Act
    ResponseContentType responseType = responseContentTypesRepository.findByContentType(videoResponseType);
    // Assert
    assertNotNull(responseType);
    assertEquals(videoResponseType, responseType.getContentType());
}
Also used : ResponseContentType(com.arbindo.mimock.entities.ResponseContentType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 34 with ResponseContentType

use of com.arbindo.mimock.entities.ResponseContentType in project mimock by neel1996.

the class ResponseContentTypesRepositoryTest method shouldReturnResponseContentTypeForValidAudioType.

@ParameterizedTest
@ValueSource(strings = { "audio/mpeg", "audio/ogg", "audio/opus", "audio/wav", "audio/webm" })
void shouldReturnResponseContentTypeForValidAudioType(String audioResponseType) {
    // Act
    ResponseContentType responseType = responseContentTypesRepository.findByContentType(audioResponseType);
    // Assert
    assertNotNull(responseType);
    assertEquals(audioResponseType, responseType.getContentType());
}
Also used : ResponseContentType(com.arbindo.mimock.entities.ResponseContentType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 35 with ResponseContentType

use of com.arbindo.mimock.entities.ResponseContentType in project mimock by neel1996.

the class ResponseContentTypesRepositoryTest method shouldReturnNullForCaseSensitiveResponseTypeStrings.

@ParameterizedTest
@ValueSource(strings = { "application/json OR 1=1", "text/css; DROP TABLE mocks;" })
void shouldReturnNullForCaseSensitiveResponseTypeStrings(String applicationResponseType) {
    // Act
    ResponseContentType responseType = responseContentTypesRepository.findByContentType(applicationResponseType);
    // Assert
    assertNull(responseType);
}
Also used : ResponseContentType(com.arbindo.mimock.entities.ResponseContentType) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ResponseContentType (com.arbindo.mimock.entities.ResponseContentType)40 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)32 ValueSource (org.junit.jupiter.params.provider.ValueSource)30 Test (org.junit.jupiter.api.Test)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 Mock (com.arbindo.mimock.entities.Mock)6 DomainModelForMock (com.arbindo.mimock.generic.model.DomainModelForMock)6 TextualResponse (com.arbindo.mimock.entities.TextualResponse)4 BinaryResponse (com.arbindo.mimock.entities.BinaryResponse)2 ArrayList (java.util.ArrayList)2 EmptySource (org.junit.jupiter.params.provider.EmptySource)2 NullSource (org.junit.jupiter.params.provider.NullSource)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 WebMvcTest (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)1 MvcResult (org.springframework.test.web.servlet.MvcResult)1