Skip to content

Commit

Permalink
refactor: cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiccoMlt committed Nov 29, 2024
1 parent d270508 commit e0633ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void buildNewServer() throws Exception {
assertNull(server);
credentials = new RawHttpClient.BasicAuthCredentials(DEFAULT_USERNAME, DEFAULT_PASSWORD);
File serverRoot = tmpDir.getRoot(); // at every reboot we must keep the same directory
server = buildForTests("localhost", 0, parent -> new TestEndpointMapper("localhost", 0), serverRoot);
server = buildForTests("localhost", 0, new TestEndpointMapper("localhost", 0), serverRoot);
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Properties;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import junitparams.naming.TestCaseName;
import org.carapaceproxy.configstore.PropertiesConfigurationStore;
import org.carapaceproxy.core.EndpointKey;
import org.carapaceproxy.core.HttpProxyServer;
Expand Down Expand Up @@ -64,7 +65,7 @@ public class StuckRequestsTest {

@Test
@Parameters({"true", "false"})
@junitparams.naming.TestCaseName("test(backend unreachable on stuck request: {0})")
@TestCaseName("test(backend unreachable on stuck request: {0})")
public void testBackendUnreachableOnStuckRequest(boolean backendsUnreachableOnStuckRequests) throws Exception {

stubFor(get(urlEqualTo("/index.html"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private File createUserFile(Map<String, String> users) throws Exception {

@Test
public void testFileUserRealm() throws Exception {
try (HttpProxyServer server = buildForTests("localhost", 0, parent -> new TestEndpointMapper("localhost", 0), tmpDir.newFolder())) {
try (HttpProxyServer server = buildForTests("localhost", 0, new TestEndpointMapper("localhost", 0), tmpDir.newFolder())) {
Properties prop = new Properties();
prop.setProperty("http.admin.enabled", "true");
prop.setProperty("http.admin.port", "8761");
Expand Down Expand Up @@ -104,7 +104,7 @@ public void testFileUserRealm() throws Exception {

@Test
public void testFileUserRealmRefresh() throws Exception {
try (HttpProxyServer server = buildForTests("localhost", 0, parent -> new TestEndpointMapper("localhost", 0), tmpDir.newFolder())) {
try (HttpProxyServer server = buildForTests("localhost", 0, new TestEndpointMapper("localhost", 0), tmpDir.newFolder())) {
Map<String, String> users = new HashMap<>();
users.put("test1", "pass1");

Expand Down Expand Up @@ -149,7 +149,7 @@ public void testFileUserRealmRefresh() throws Exception {

@Test
public void testFileRelativePath() throws Exception {
try (HttpProxyServer server = buildForTests("localhost", 0, parent -> new TestEndpointMapper("localhost", 0), tmpDir.newFolder())) {
try (HttpProxyServer server = buildForTests("localhost", 0, new TestEndpointMapper("localhost", 0), tmpDir.newFolder())) {
Properties prop = new Properties();
prop.setProperty("http.admin.enabled", "true");
prop.setProperty("http.admin.port", "8761");
Expand Down

0 comments on commit e0633ba

Please sign in to comment.