Skip to content

Commit

Permalink
test: Fix class initialisation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Jan 9, 2025
1 parent 82b66e2 commit b03d43d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/test/java/com/vonage/client/AbstractMethodTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import org.apache.http.message.BasicStatusLine;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.mockito.ArgumentCaptor;
import static org.mockito.Mockito.*;
import java.io.*;
Expand All @@ -54,6 +52,11 @@ public ConcreteMethod(HttpWrapper httpWrapper) {
super(httpWrapper);
}

static {
LogManager.getLogManager().getLogger(AbstractMethod.class.getName())
.setLevel(java.util.logging.Level.FINE);
}

RequestBuilder makeRequest() throws UnsupportedEncodingException {
return makeRequest("http://example.org/resource")
.addParameter("foo", "bar")
Expand Down Expand Up @@ -110,12 +113,6 @@ public void close() {
private AuthMethod mockAuthMethod;
private final CloseableHttpResponse basicResponse = new CloseableBasicHttpResponse();

@BeforeAll
public static void setUpBeforeClass() {
LogManager.getLogManager().getLogger(AbstractMethod.class.getName())
.setLevel(java.util.logging.Level.FINE);
}

@BeforeEach
public void setUp() throws Exception {
mockWrapper = mock(HttpWrapper.class);
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/com/vonage/client/DynamicEndpointTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DynamicEndpointTest {
private static final HttpWrapper WRAPPER = new HttpWrapper(new NoAuthMethod());

@SuppressWarnings("unchecked")
static <T, R> DynamicEndpoint<T, R> newEndpoint(R... responseType) {
return DynamicEndpoint.<T, R> builder(responseType)
var endpoint = DynamicEndpoint.<T, R> builder(responseType)
.wrapper(WRAPPER).authMethod(NoAuthMethod.class)
.pathGetter((de, req) -> TEST_BASE_URI)
.requestMethod(HttpMethod.GET).acceptHeader("text").build();
Logger.getLogger(endpoint.getClass().getName()).setLevel(Level.FINE);
return endpoint;
}

@Test
Expand Down

0 comments on commit b03d43d

Please sign in to comment.