Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<swagger.ui.path>META-INF/resources/webjars/swagger-ui/${swagger.ui.version}/</swagger.ui.path>
<mockserver.version>5.15.0</mockserver.version>
<junit.version>6.0.1</junit.version>
<mockito.version>5.20.0</mockito.version>
<sonar.plugin.version>5.3.0.6276</sonar.plugin.version>
<netty.override.version>4.2.7.Final</netty.override.version>
<mockito.version>5.21.0</mockito.version>
<sonar.plugin.version>5.5.0.6356</sonar.plugin.version>
<netty.override.version>4.2.8.Final</netty.override.version>
<spotless.version>3.1.0</spotless.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -419,7 +419,7 @@
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-bom</artifactId>
<type>pom</type>
<version>3.50.0</version>
<version>3.51.0</version>
<scope>import</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -542,7 +542,7 @@
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>8.27.1</version>
<version>8.28.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -806,7 +806,7 @@
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>9.2.1</version>
<version>9.2.2</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.broadinstitute.consent.http.service;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.when;
import static org.mockserver.model.HttpRequest.request;
Expand All @@ -9,6 +8,8 @@
import com.google.api.client.http.HttpStatusCodes;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.ServerErrorException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
Expand All @@ -27,7 +28,7 @@
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockserver.model.Header;
import org.mockserver.model.HttpError;
import org.mockserver.model.HttpRequest;
import org.mockserver.verify.VerificationTimes;

@ExtendWith(MockitoExtension.class)
class SupportRequestServiceTest extends MockServerTestHelper {
Expand All @@ -43,7 +44,7 @@ void init() {
@Test
void testPostTicketToSupport() throws Exception {
DuosTicket ticket = generateTicket();
String expectedBody = ticket.toString().replaceAll("\\s*", "");
String expectedBody = ticket.toString();

when(config.isActivateSupportNotifications()).thenReturn(true);
when(config.postSupportRequestUrl())
Expand All @@ -57,11 +58,10 @@ void testPostTicketToSupport() throws Exception {
.withBody(expectedBody));

service.postTicketToSupport(ticket);
HttpRequest[] requests = mockServerClient.retrieveRecordedRequests(null);
assertEquals(1, requests.length);
// Ensure that we really did send a ticket object in the POST request
String requestBody = requests[0].getBody().getValue().toString().replaceAll("\\s*", "");
assertEquals(expectedBody, requestBody);
URL supportUrl = URI.create(config.postSupportRequestUrl()).toURL();
mockServerClient.verify(
request().withPath(supportUrl.getPath()).withBody(expectedBody),
VerificationTimes.exactly(1));
}

@Test
Expand Down Expand Up @@ -122,8 +122,8 @@ void testPostAttachmentToSupport() throws Exception {
.withBody(expectedBody));
service = new SupportRequestService(config);
service.postAttachmentToSupport("Test".getBytes());
HttpRequest[] requests = mockServerClient.retrieveRecordedRequests(null);
assertEquals(1, requests.length);
URL supportUrl = URI.create(config.postSupportUploadUrl()).toURL();
mockServerClient.verify(request().withPath(supportUrl.getPath()), VerificationTimes.exactly(1));
}

@Test
Expand Down
Loading