Skip to content

Commit

Permalink
Fixed #425 - Upgraded Dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
khmarbaise committed Sep 15, 2019
1 parent e128583 commit 06db74d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;



Expand All @@ -30,7 +31,7 @@
*/
public class JenkinsHttpClientTest {
private static final String URI = "http://localhost/jenkins";



@Test
Expand All @@ -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);
Expand All @@ -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");
}


Expand Down
25 changes: 12 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<!-- Version of Jenkins to use for Integration Tests -->
<jenkins-version>1.644</jenkins-version>
<junit.version>4.12</junit.version>
<mockito-core.version>1.9.5</mockito-core.version>
<mockito-core.version>3.0.0</mockito-core.version>
<commons-io.version>2.4</commons-io.version>
<xstream.version>1.4.7-jenkins-1</xstream.version>
<dom4j.version>1.6.1</dom4j.version>
Expand Down Expand Up @@ -166,33 +166,35 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.5.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>${jenkins-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.12.2</version>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -202,13 +204,10 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.1</version>
<artifactId>log4j-bom</artifactId>
<version>2.12.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
Expand Down

0 comments on commit 06db74d

Please sign in to comment.