Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update external dependencies as well as internal one (plugins + test) #63

Merged
merged 1 commit into from
Aug 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,46 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<version>4.13</version>
<type>jar</type>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
<version>2.8.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3</version>
<version>4.4.13</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.1</version>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.17</version>
<version>3.4.6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -114,7 +114,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
Expand All @@ -125,7 +125,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.8.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
Expand All @@ -135,7 +135,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -153,7 +153,7 @@
<nohelp>true</nohelp>
<doclint>none</doclint>
</configuration>
<version>3.0.0</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -171,7 +171,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<version>3.2.0</version>
<configuration>
<stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>
<show>public</show>
Expand Down
19 changes: 9 additions & 10 deletions src/test/com/sailthru/client/AbstractSailthruClientTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.sailthru.client;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.sailthru.client.http.SailthruHttpClient;
import com.sailthru.client.params.Send;
import org.apache.http.HttpHost;
Expand All @@ -18,17 +17,17 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.Map;

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

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

Expand Down Expand Up @@ -95,7 +94,7 @@ public void testGetLastRateLimitInfoDifferentActions() throws IOException {
doReturn(sendHttpResponse).doReturn(listHttpResponse)
.doReturn(returnHttpResponse)
.when(httpClient)
.execute(any(HttpHost.class), any(HttpRequest.class), any(HttpContext.class));
.execute(any(HttpHost.class), any(HttpRequest.class), (HttpContext)any());

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

doReturn(getHttpResponse).doReturn(postHttpResponse).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), any(HttpContext.class));
doReturn(getHttpResponse).doReturn(postHttpResponse).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), (HttpContext)any());

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

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