From f9191c54ecc34e65cb88f047672ddf2fb2ae0eeb Mon Sep 17 00:00:00 2001 From: Thomas Richner Date: Thu, 5 Dec 2024 10:35:30 +0100 Subject: [PATCH] EPA-171: Fix tests --- .../ws/ThrowableExceptionMapperTest.java | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/ehealthid-rp/src/test/java/com/oviva/ehealthid/relyingparty/ws/ThrowableExceptionMapperTest.java b/ehealthid-rp/src/test/java/com/oviva/ehealthid/relyingparty/ws/ThrowableExceptionMapperTest.java index 87843dd..2f59412 100644 --- a/ehealthid-rp/src/test/java/com/oviva/ehealthid/relyingparty/ws/ThrowableExceptionMapperTest.java +++ b/ehealthid-rp/src/test/java/com/oviva/ehealthid/relyingparty/ws/ThrowableExceptionMapperTest.java @@ -9,14 +9,12 @@ import com.github.mustachejava.util.HtmlEscaper; import com.oviva.ehealthid.relyingparty.svc.AuthenticationException; import com.oviva.ehealthid.relyingparty.svc.ValidationException; -import com.oviva.ehealthid.relyingparty.ws.ThrowableExceptionMapper.Problem; import jakarta.ws.rs.NotFoundException; import jakarta.ws.rs.ServerErrorException; import jakarta.ws.rs.core.*; import java.io.StringWriter; import java.net.URI; import java.nio.charset.StandardCharsets; -import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -145,7 +143,6 @@ void toResponse_authentication() { void toResponse_withBody() { when(uriInfo.getRequestUri()).thenReturn(REQUEST_URI); - when(headers.getAcceptableMediaTypes()).thenReturn(List.of(MediaType.WILDCARD_TYPE)); mockHeaders("de-DE"); // when @@ -157,27 +154,6 @@ void toResponse_withBody() { assertNotNull(res.getEntity()); } - @Test - void toResponse_withJson() { - - when(headers.getAcceptableMediaTypes()) - .thenReturn( - List.of( - MediaType.APPLICATION_JSON_TYPE, - MediaType.TEXT_HTML_TYPE, - MediaType.WILDCARD_TYPE)); - - var msg = "Ooops! An error :/"; - - // when - var res = mapper.toResponse(new ValidationException(new Message(msg))); - - // then - assertEquals(400, res.getStatus()); - assertEquals(MediaType.APPLICATION_JSON_TYPE, res.getMediaType()); - assertEquals(new Problem("/server_error", msg), res.getEntity()); - } - @Test void toResponse_withBody_Unauthorized() { // when @@ -203,7 +179,6 @@ void toResponse_withBody_seeOthers() { @Test void toResponse_withBody_withValidationExc() { - when(headers.getAcceptableMediaTypes()).thenReturn(List.of(MediaType.WILDCARD_TYPE)); doReturn("de-DE").when(headers).getHeaderString("Accept-Language"); // when @@ -221,7 +196,6 @@ void toResponse_withBody_withValidationExc() { void toResponse_withBody_withValidationExceptionAndDynamicContent( String language, String messageKey, String message) { - when(headers.getAcceptableMediaTypes()).thenReturn(List.of(MediaType.WILDCARD_TYPE)); doReturn(language).when(headers).getHeaderString("Accept-Language"); // when