Add annotation to catch empty request body

This commit is contained in:
Katherine Yen
2023-05-17 14:00:16 -07:00
parent 0706171264
commit 9450f88c8c
3 changed files with 27 additions and 3 deletions

View File

@@ -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))