Skip to content

Commit

Permalink
fixup! fixup! allow JSON POSTs with ID fields for particular endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Mar 7, 2024
1 parent 15f8eb8 commit 4d37279
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/java/io/cryostat/JsonRequestFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.Mockito;

public class JsonRequestFilterTest {
private JsonRequestFilter filter;
Expand Down Expand Up @@ -76,6 +78,9 @@ private void simulateRequest(String jsonPayload) throws Exception {
new ByteArrayInputStream(jsonPayload.getBytes(StandardCharsets.UTF_8));
when(requestContext.getEntityStream()).thenReturn(payloadStream);
when(requestContext.getMediaType()).thenReturn(MediaType.APPLICATION_JSON_TYPE);
UriInfo uriInfo = Mockito.mock(UriInfo.class);
when(uriInfo.getPath()).thenReturn("/api/v3/rules");
when(requestContext.getUriInfo()).thenReturn(uriInfo);
filter.filter(requestContext);
}
}

0 comments on commit 4d37279

Please sign in to comment.