Skip to content

Commit

Permalink
Extract private method to ensure changes to DefaultMockServer usage a…
Browse files Browse the repository at this point in the history
…re consistent.
  • Loading branch information
SamBarker committed Jul 22, 2024
1 parent cbee038 commit 3d39532
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class AbstractInterceptorTest {

@BeforeEach
void startServer() {
server = new DefaultMockServer(false);
server = newMockServer();
server.start();
}

Expand Down Expand Up @@ -211,7 +211,7 @@ public void afterConnectionFailureRetry() {
.addOrReplaceInterceptor("test", new Interceptor() {
@Override
public void afterConnectionFailure(HttpRequest request, Throwable failure) {
server = new DefaultMockServer(false);
server = newMockServer();
server.expect().withPath("/intercepted-url").andReturn(200, "This works").once();
server.start(originalPort); // Need to restart on the original port as we can't alter the request during retry.
}
Expand Down Expand Up @@ -475,4 +475,7 @@ public void before(BasicBuilder builder, HttpRequest request, RequestTags tags)
.containsEntry("test-header", Collections.singletonList("Test-Value-Override"));
}

private static DefaultMockServer newMockServer() {
return new DefaultMockServer(false);
}
}

0 comments on commit 3d39532

Please sign in to comment.