diff --git a/jenkins-client/src/test/java/com/offbytwo/jenkins/client/JenkinsHttpClientTest.java b/jenkins-client/src/test/java/com/offbytwo/jenkins/client/JenkinsHttpClientTest.java
index 80f3ba38..2e3bce09 100644
--- a/jenkins-client/src/test/java/com/offbytwo/jenkins/client/JenkinsHttpClientTest.java
+++ b/jenkins-client/src/test/java/com/offbytwo/jenkins/client/JenkinsHttpClientTest.java
@@ -5,6 +5,12 @@
*/
package com.offbytwo.jenkins.client;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
+
import java.io.ByteArrayInputStream;
import java.net.URI;
import org.apache.http.Header;
@@ -15,12 +21,7 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.protocol.HttpContext;
-import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
@@ -30,7 +31,7 @@
*/
public class JenkinsHttpClientTest {
private static final String URI = "http://localhost/jenkins";
-
+
@Test
@@ -40,8 +41,8 @@ public void testGet_String() throws Exception {
final Header versionHeader = mock(Header.class);
final StatusLine statusLine = mock(StatusLine.class);
final HttpEntity entity = mock(HttpEntity.class);
- given(client.execute(any(HttpUriRequest.class), any(HttpContext.class))).willReturn(response);
- given(response.getHeaders(anyString())).willReturn(new Header[]{versionHeader});
+ given(client.execute(any(HttpUriRequest.class), eq((HttpContext)null))).willReturn(response);
+ given(response.getHeaders("X-Jenkins")).willReturn(new Header[]{versionHeader});
given(response.getStatusLine()).willReturn(statusLine);
given(versionHeader.getValue()).willReturn("1.234");
given(statusLine.getStatusCode()).willReturn(HttpStatus.SC_OK);
@@ -51,15 +52,15 @@ public void testGet_String() throws Exception {
final String s = jclient.get("job/someJob");
assertEquals("someJson", s);
}
-
-
-
+
+
+
@Test(expected=IllegalStateException.class)
public void testClose() throws Exception {
final JenkinsHttpConnection jclient = new JenkinsHttpClient(new URI(URI));
jclient.close();
jclient.close(); //check multiple calls yield no errors
- jclient.get("job/someJob");
+ jclient.get("job/someJob");
}
diff --git a/pom.xml b/pom.xml
index ffa639db..68704676 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,7 +53,7 @@
1.644
4.12
- 1.9.5
+ 3.0.0
2.4
1.4.7-jenkins-1
1.6.1
@@ -166,33 +166,35 @@
org.testng
testng
7.0.0
- test
+
+
+ org.junit
+ junit-bom
+ 5.5.2
+ import
+ pom
junit
junit
${junit.version}
- test
org.mockito
mockito-core
${mockito-core.version}
- test
org.jenkins-ci.main
jenkins-test-harness
${jenkins-version}
- test
org.assertj
assertj-core
3.12.2
- test
@@ -202,13 +204,10 @@
org.apache.logging.log4j
- log4j-core
- 2.11.1
-
-
- org.apache.logging.log4j
- log4j-slf4j-impl
- 2.11.1
+ log4j-bom
+ 2.12.1
+ import
+ pom
xml-apis