Skip to content

Commit fac5e3d

Browse files
committed
- Update very old dependencies that are least susceptible to cause conflict in today's environment
- Update gson to 2.8.6 - Update httpclient to 4.5.12 and httpcore to 4.4.13 - Update slf4j to 1.7.30 - For internal use, update junit to 4.13, mockito to 3.4.6 and all maven plugins - Fix unit test to have correct mocking and remove deprecated usages
1 parent e81dbc6 commit fac5e3d

2 files changed

Lines changed: 22 additions & 23 deletions

File tree

pom.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,46 @@
5454
<dependency>
5555
<groupId>junit</groupId>
5656
<artifactId>junit</artifactId>
57-
<version>4.9</version>
57+
<version>4.13</version>
5858
<type>jar</type>
5959
<scope>test</scope>
6060
<optional>true</optional>
6161
</dependency>
6262
<dependency>
6363
<groupId>com.google.code.gson</groupId>
6464
<artifactId>gson</artifactId>
65-
<version>2.2.4</version>
65+
<version>2.8.6</version>
6666
<scope>compile</scope>
6767
</dependency>
6868
<dependency>
6969
<groupId>org.apache.httpcomponents</groupId>
7070
<artifactId>httpclient</artifactId>
71-
<version>4.3.6</version>
71+
<version>4.5.12</version>
7272
</dependency>
7373
<dependency>
7474
<groupId>org.apache.httpcomponents</groupId>
7575
<artifactId>httpcore</artifactId>
76-
<version>4.3</version>
76+
<version>4.4.13</version>
7777
</dependency>
7878
<dependency>
7979
<groupId>org.apache.httpcomponents</groupId>
8080
<artifactId>httpmime</artifactId>
81-
<version>4.3.1</version>
81+
<version>4.5.12</version>
8282
</dependency>
8383
<dependency>
8484
<groupId>org.slf4j</groupId>
8585
<artifactId>slf4j-api</artifactId>
86-
<version>1.7.5</version>
86+
<version>1.7.30</version>
8787
</dependency>
8888
<dependency>
8989
<groupId>org.slf4j</groupId>
9090
<artifactId>slf4j-simple</artifactId>
91-
<version>1.7.5</version>
91+
<version>1.7.30</version>
9292
</dependency>
9393
<dependency>
9494
<groupId>org.mockito</groupId>
9595
<artifactId>mockito-core</artifactId>
96-
<version>1.10.17</version>
96+
<version>3.4.6</version>
9797
<scope>test</scope>
9898
</dependency>
9999
<dependency>
@@ -114,7 +114,7 @@
114114
<plugin>
115115
<groupId>org.sonatype.plugins</groupId>
116116
<artifactId>nexus-staging-maven-plugin</artifactId>
117-
<version>1.6.3</version>
117+
<version>1.6.8</version>
118118
<extensions>true</extensions>
119119
<configuration>
120120
<serverId>sonatype-nexus-staging</serverId>
@@ -125,7 +125,7 @@
125125
<plugin>
126126
<groupId>org.apache.maven.plugins</groupId>
127127
<artifactId>maven-compiler-plugin</artifactId>
128-
<version>2.3.2</version>
128+
<version>3.8.1</version>
129129
<configuration>
130130
<source>1.6</source>
131131
<target>1.6</target>
@@ -135,7 +135,7 @@
135135
<plugin>
136136
<groupId>org.apache.maven.plugins</groupId>
137137
<artifactId>maven-source-plugin</artifactId>
138-
<version>2.2.1</version>
138+
<version>3.2.1</version>
139139
<executions>
140140
<execution>
141141
<id>attach-sources</id>
@@ -153,7 +153,7 @@
153153
<nohelp>true</nohelp>
154154
<doclint>none</doclint>
155155
</configuration>
156-
<version>3.0.0</version>
156+
<version>3.2.0</version>
157157
<executions>
158158
<execution>
159159
<id>attach-javadocs</id>
@@ -171,7 +171,7 @@
171171
<plugin>
172172
<groupId>org.apache.maven.plugins</groupId>
173173
<artifactId>maven-javadoc-plugin</artifactId>
174-
<version>3.0.0</version>
174+
<version>3.2.0</version>
175175
<configuration>
176176
<stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>
177177
<show>public</show>

src/test/com/sailthru/client/AbstractSailthruClientTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.sailthru.client;
22

33
import com.google.common.collect.ImmutableMap;
4-
import com.google.common.collect.Lists;
54
import com.sailthru.client.http.SailthruHttpClient;
65
import com.sailthru.client.params.Send;
76
import org.apache.http.HttpHost;
@@ -18,17 +17,17 @@
1817
import org.junit.Before;
1918
import org.junit.Test;
2019
import org.junit.runner.RunWith;
21-
import org.mockito.runners.MockitoJUnitRunner;
20+
import org.mockito.junit.MockitoJUnitRunner;
2221

2322
import java.io.ByteArrayInputStream;
2423
import java.io.IOException;
2524
import java.util.Collections;
2625
import java.util.Date;
2726
import java.util.Map;
2827

29-
import static junit.framework.Assert.assertEquals;
30-
import static org.mockito.Matchers.any;
31-
import static org.mockito.Matchers.eq;
28+
import static org.junit.Assert.assertEquals;
29+
import static org.mockito.ArgumentMatchers.any;
30+
import static org.mockito.ArgumentMatchers.eq;
3231
import static org.mockito.Mockito.doReturn;
3332
import static org.mockito.Mockito.mock;
3433
import static org.mockito.Mockito.spy;
@@ -59,7 +58,7 @@ public void testGetLastRateLimitInfo() throws IOException {
5958
long resetTs = ((new Date().getTime() / 1000) * 1000) + 18000; // pretend the top of the next minute is 18 seconds from now
6059
Date resetDate = new Date(resetTs);
6160
CloseableHttpResponse httpResponse = getMockHttpResponseWithRateLimitHeaders(limit, remaining, resetDate);
62-
doReturn(httpResponse).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), any(HttpContext.class));
61+
doReturn(httpResponse).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), (HttpContext)any());
6362

6463
sailthruClient.apiGet(ApiAction.send, ImmutableMap.<String,Object>of(Send.PARAM_SEND_ID, "some valid send id"));
6564

@@ -95,7 +94,7 @@ public void testGetLastRateLimitInfoDifferentActions() throws IOException {
9594
doReturn(sendHttpResponse).doReturn(listHttpResponse)
9695
.doReturn(returnHttpResponse)
9796
.when(httpClient)
98-
.execute(any(HttpHost.class), any(HttpRequest.class), any(HttpContext.class));
97+
.execute(any(HttpHost.class), any(HttpRequest.class), (HttpContext)any());
9998

10099
sailthruClient.apiGet(ApiAction.send, ImmutableMap.<String,Object>of(Send.PARAM_SEND_ID, "some valid send id"));
101100
sailthruClient.apiGet(ApiAction.list, ImmutableMap.<String,Object>of("list", "some list"));
@@ -133,7 +132,7 @@ public void testGetLastRateLimitInfoDifferentMethods() throws IOException {
133132
Date postResetDate = new Date(postResetTs);
134133
CloseableHttpResponse postHttpResponse = getMockHttpResponseWithRateLimitHeaders(postLimit, postRemaining, postResetDate);
135134

136-
doReturn(getHttpResponse).doReturn(postHttpResponse).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), any(HttpContext.class));
135+
doReturn(getHttpResponse).doReturn(postHttpResponse).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), (HttpContext)any());
137136

138137
sailthruClient.apiGet(ApiAction.list, ImmutableMap.<String,Object>of("list", "some list"));
139138
sailthruClient.apiPost(ApiAction.list, ImmutableMap.<String,Object>of("list", "some new list"));
@@ -152,10 +151,10 @@ public void testGetLastRateLimitInfoDifferentMethods() throws IOException {
152151
@Test
153152
public void testReturnUrl() throws IOException {
154153
CloseableHttpResponse response = getMockHttpResponseWithRateLimitHeaders(1, 1, new Date());
155-
doReturn(response).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), any(HttpContext.class));
154+
doReturn(response).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), (HttpContext)any());
156155
sailthruClient.apiPost(ApiAction.RETURN, Collections.<String, Object>emptyMap());
157156
verify(httpClient).executeHttpRequest(eq("https://api.sailthru.com/return"), eq(AbstractSailthruClient.HttpRequestMethod.POST),
158-
any(Map.class), any(ResponseHandler.class), any(Map.class));
157+
any(Map.class), any(ResponseHandler.class), (Map)any());
159158
}
160159

161160
private CloseableHttpResponse getMockHttpResponseWithRateLimitHeaders(int limit, int remaining, Date reset) {

0 commit comments

Comments
 (0)