Skip to content

Commit 06db74d

Browse files
committed
Fixed #425 - Upgraded Dependencies.
1 parent e128583 commit 06db74d

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

jenkins-client/src/test/java/com/offbytwo/jenkins/client/JenkinsHttpClientTest.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
*/
66
package com.offbytwo.jenkins.client;
77

8+
import static org.junit.Assert.assertEquals;
9+
import static org.mockito.ArgumentMatchers.any;
10+
import static org.mockito.ArgumentMatchers.eq;
11+
import static org.mockito.BDDMockito.given;
12+
import static org.mockito.Mockito.mock;
13+
814
import java.io.ByteArrayInputStream;
915
import java.net.URI;
1016
import org.apache.http.Header;
@@ -15,12 +21,7 @@
1521
import org.apache.http.client.methods.HttpUriRequest;
1622
import org.apache.http.impl.client.CloseableHttpClient;
1723
import org.apache.http.protocol.HttpContext;
18-
import static org.junit.Assert.assertEquals;
1924
import org.junit.Test;
20-
import static org.mockito.BDDMockito.given;
21-
import static org.mockito.Matchers.any;
22-
import static org.mockito.Matchers.anyString;
23-
import static org.mockito.Mockito.mock;
2425

2526

2627

@@ -30,7 +31,7 @@
3031
*/
3132
public class JenkinsHttpClientTest {
3233
private static final String URI = "http://localhost/jenkins";
33-
34+
3435

3536

3637
@Test
@@ -40,8 +41,8 @@ public void testGet_String() throws Exception {
4041
final Header versionHeader = mock(Header.class);
4142
final StatusLine statusLine = mock(StatusLine.class);
4243
final HttpEntity entity = mock(HttpEntity.class);
43-
given(client.execute(any(HttpUriRequest.class), any(HttpContext.class))).willReturn(response);
44-
given(response.getHeaders(anyString())).willReturn(new Header[]{versionHeader});
44+
given(client.execute(any(HttpUriRequest.class), eq((HttpContext)null))).willReturn(response);
45+
given(response.getHeaders("X-Jenkins")).willReturn(new Header[]{versionHeader});
4546
given(response.getStatusLine()).willReturn(statusLine);
4647
given(versionHeader.getValue()).willReturn("1.234");
4748
given(statusLine.getStatusCode()).willReturn(HttpStatus.SC_OK);
@@ -51,15 +52,15 @@ public void testGet_String() throws Exception {
5152
final String s = jclient.get("job/someJob");
5253
assertEquals("someJson", s);
5354
}
54-
55-
56-
55+
56+
57+
5758
@Test(expected=IllegalStateException.class)
5859
public void testClose() throws Exception {
5960
final JenkinsHttpConnection jclient = new JenkinsHttpClient(new URI(URI));
6061
jclient.close();
6162
jclient.close(); //check multiple calls yield no errors
62-
jclient.get("job/someJob");
63+
jclient.get("job/someJob");
6364
}
6465

6566

pom.xml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<!-- Version of Jenkins to use for Integration Tests -->
5454
<jenkins-version>1.644</jenkins-version>
5555
<junit.version>4.12</junit.version>
56-
<mockito-core.version>1.9.5</mockito-core.version>
56+
<mockito-core.version>3.0.0</mockito-core.version>
5757
<commons-io.version>2.4</commons-io.version>
5858
<xstream.version>1.4.7-jenkins-1</xstream.version>
5959
<dom4j.version>1.6.1</dom4j.version>
@@ -166,33 +166,35 @@
166166
<groupId>org.testng</groupId>
167167
<artifactId>testng</artifactId>
168168
<version>7.0.0</version>
169-
<scope>test</scope>
169+
</dependency>
170+
<dependency>
171+
<groupId>org.junit</groupId>
172+
<artifactId>junit-bom</artifactId>
173+
<version>5.5.2</version>
174+
<scope>import</scope>
175+
<type>pom</type>
170176
</dependency>
171177
<dependency>
172178
<groupId>junit</groupId>
173179
<artifactId>junit</artifactId>
174180
<version>${junit.version}</version>
175-
<scope>test</scope>
176181
</dependency>
177182

178183
<dependency>
179184
<groupId>org.mockito</groupId>
180185
<artifactId>mockito-core</artifactId>
181186
<version>${mockito-core.version}</version>
182-
<scope>test</scope>
183187
</dependency>
184188

185189
<dependency>
186190
<groupId>org.jenkins-ci.main</groupId>
187191
<artifactId>jenkins-test-harness</artifactId>
188192
<version>${jenkins-version}</version>
189-
<scope>test</scope>
190193
</dependency>
191194
<dependency>
192195
<groupId>org.assertj</groupId>
193196
<artifactId>assertj-core</artifactId>
194197
<version>3.12.2</version>
195-
<scope>test</scope>
196198
</dependency>
197199

198200
<dependency>
@@ -202,13 +204,10 @@
202204
</dependency>
203205
<dependency>
204206
<groupId>org.apache.logging.log4j</groupId>
205-
<artifactId>log4j-core</artifactId>
206-
<version>2.11.1</version>
207-
</dependency>
208-
<dependency>
209-
<groupId>org.apache.logging.log4j</groupId>
210-
<artifactId>log4j-slf4j-impl</artifactId>
211-
<version>2.11.1</version>
207+
<artifactId>log4j-bom</artifactId>
208+
<version>2.12.1</version>
209+
<scope>import</scope>
210+
<type>pom</type>
212211
</dependency>
213212
<dependency>
214213
<groupId>xml-apis</groupId>

0 commit comments

Comments
 (0)