Add annotation to catch empty request body

This commit is contained in:
Katherine Yen committed 2023-05-17 14:28:41 -07:00
1 parent 0706171264
commit 9450f88c8c
3 files changed
+27 -3

No files matched your search

@@ -100,6 +100,28 @@ public class CallLinkControllerTest {
}
}
@Test
void testGetCreateAuthInvalidInputEmptyRequestBody() {
try (Response response = resources.getJerseyTest()
.target("/v1/call-link/create-auth")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
.post(Entity.json("{}"))) {
assertThat(response.getStatus()).isEqualTo(422);
}
}
@Test
void testGetCreateAuthInvalidInputEmptyField() {
try (Response response = resources.getJerseyTest()
.target("/v1/call-link/create-auth")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
.post(Entity.json("{\"createCallLinkCredentialRequest\": \"\"}"))) {
assertThat(response.getStatus()).isEqualTo(422);
}
}
@Test
void testGetCreateAuthRatelimited() throws RateLimitExceededException{
doThrow(new RateLimitExceededException(null, false))