TSK-1822: fix error message for wrong order parameter
This commit is contained in:
parent
71f928972d
commit
70dfebb432
|
@ -222,7 +222,8 @@ public class TaskanaRestExceptionHandler extends ResponseEntityExceptionHandler
|
|||
// value for the error output and want to use the contains performance boost of a HashSet.
|
||||
List<String> enumConstants =
|
||||
Arrays.stream(targetType.getEnumConstants())
|
||||
.map(Object::toString)
|
||||
.map(Enum.class::cast)
|
||||
.map(Enum::name)
|
||||
.collect(Collectors.toList());
|
||||
Set<String> enumConstantSet = new HashSet<>(enumConstants);
|
||||
|
||||
|
|
|
@ -1092,6 +1092,25 @@ class TaskControllerIntTest {
|
|||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_ThrowException_When_ProvidingInvalidOrder() {
|
||||
String url =
|
||||
restHelper.toUrl(RestEndpoints.URL_TASKS)
|
||||
+ "?workbasket-id=WBI:100000000000000000000000000000000001"
|
||||
+ "&sort-by=NAME&order=WRONG";
|
||||
HttpEntity<Object> auth = new HttpEntity<>(RestHelper.generateHeadersForUser("teamlead-1"));
|
||||
|
||||
ThrowingCallable httpCall =
|
||||
() -> TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_SUMMARY_PAGE_MODEL_TYPE);
|
||||
|
||||
assertThatThrownBy(httpCall)
|
||||
.isInstanceOf(HttpStatusCodeException.class)
|
||||
.hasMessageContaining("\"expectedValues\":[\"ASCENDING\",\"DESCENDING\"]")
|
||||
.extracting(HttpStatusCodeException.class::cast)
|
||||
.extracting(HttpStatusCodeException::getStatusCode)
|
||||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
Stream<DynamicTest> should_SetTransferFlagDependentOnRequestBody_When_TransferringTask() {
|
||||
Iterator<Boolean> iterator = Arrays.asList(true, false).iterator();
|
||||
|
|
Loading…
Reference in New Issue