use of com.arbindo.mimock.entities.HttpMethod in project mimock by arbindo.
the class GetStaticRecordsServiceImplTest method shouldReturnAllSupportedHttpMethods.
@Test
void shouldReturnAllSupportedHttpMethods() {
List<HttpMethod> httpMethodsFromDB = new ArrayList<>();
HttpMethod getMethod = HttpMethod.builder().method("GET").build();
HttpMethod postMethod = HttpMethod.builder().method("POST").build();
httpMethodsFromDB.add(getMethod);
httpMethodsFromDB.add(postMethod);
lenient().when(mockHttpMethodsRepository.findAll()).thenReturn(httpMethodsFromDB);
List<HttpMethod> httpMethods = service.listAllSupportedHttpMethods();
assertNotNull(httpMethods);
assertNotEquals(0, httpMethods.size());
assertEquals("GET", httpMethods.get(0).getMethod());
assertEquals("POST", httpMethods.get(1).getMethod());
}
use of com.arbindo.mimock.entities.HttpMethod in project mimock by arbindo.
the class HttpMethodsRepositoryTest method shouldReturnNullForCaseSensitiveMethodStrings.
@ParameterizedTest
@ValueSource(strings = { "get", "Head", "pOSt", "put", "Delete", "connect", "Options", "trace", "PaTch" })
void shouldReturnNullForCaseSensitiveMethodStrings(String method) {
// Act
HttpMethod httpMethod = httpMethodsRepository.findByMethod(method);
// Assert
assertNull(httpMethod);
}
use of com.arbindo.mimock.entities.HttpMethod in project mimock by arbindo.
the class HttpMethodsRepositoryTest method shouldReturnNullForInvalidMethod.
@ParameterizedTest
@ValueSource(strings = { "TEST", "RANDOM", "EXEC", "123X" })
void shouldReturnNullForInvalidMethod(String method) {
// Act
HttpMethod httpMethod = httpMethodsRepository.findByMethod(method);
// Assert
assertNull(httpMethod);
}
use of com.arbindo.mimock.entities.HttpMethod in project mimock by neel1996.
the class HttpMethodsRepositoryTest method shouldReturnNullForInvalidMethodWhenEmptyOrNull.
@ParameterizedTest
@EmptySource
@NullSource
void shouldReturnNullForInvalidMethodWhenEmptyOrNull(String method) {
// Act
HttpMethod httpMethod = httpMethodsRepository.findByMethod(method);
// Assert
assertNull(httpMethod);
}
use of com.arbindo.mimock.entities.HttpMethod in project mimock by neel1996.
the class HttpMethodsRepositoryTest method shouldReturnNullForInvalidMethodForSqlInjectionStrings.
@ParameterizedTest
@ValueSource(strings = { "get OR 1=1", "GET; DROP TABLE mocks;" })
void shouldReturnNullForInvalidMethodForSqlInjectionStrings(String method) {
// Act
HttpMethod httpMethod = httpMethodsRepository.findByMethod(method);
// Assert
assertNull(httpMethod);
}
Aggregations