diff --git a/pom.xml b/pom.xml
index 103f749..a0d7c25 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,60 +1,60 @@
-
- 4.0.0
-
- io.ljunggren
- ups-api
- 0.0.1-SNAPSHOT
- jar
-
- ups-api
- http://maven.apache.org
-
-
- UTF-8
- 1.8
- 1.8
-
-
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.8
-
-
- com.fasterxml.jackson.core
- jackson-databind
- 2.9.9
-
-
- io.ljunggren
- json-utils
- 0.0.1-SNAPSHOT
-
-
- commons-io
- commons-io
- 2.8.0
-
-
- org.projectlombok
- lombok
- 1.18.12
- provided
-
-
- junit
- junit
- 4.13
- test
-
-
- org.mockito
- mockito-all
- 1.10.19
- test
-
-
-
+
+ 4.0.0
+
+ io.ljunggren
+ ups-api
+ 0.0.1-SNAPSHOT
+ jar
+
+ ups-api
+ http://maven.apache.org
+
+
+ UTF-8
+ 1.8
+ 1.8
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.8
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.9.9
+
+
+ io.ljunggren
+ json-utils
+ 0.0.1-SNAPSHOT
+
+
+ commons-io
+ commons-io
+ 2.8.0
+
+
+ org.projectlombok
+ lombok
+ 1.18.22
+ provided
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+ org.mockito
+ mockito-core
+ 4.3.1
+ test
+
+
+
diff --git a/src/test/java/io/ljunggren/ups/api/UpsApiTest.java b/src/test/java/io/ljunggren/ups/api/UpsApiTest.java
index d5698a5..2407a3c 100644
--- a/src/test/java/io/ljunggren/ups/api/UpsApiTest.java
+++ b/src/test/java/io/ljunggren/ups/api/UpsApiTest.java
@@ -1,86 +1,86 @@
-package io.ljunggren.ups.api;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpEntity;
-import org.apache.http.StatusLine;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-@RunWith(MockitoJUnitRunner.class)
-public class UpsApiTest {
-
- @Mock
- private CloseableHttpClient httpClient;
-
- @Mock
- private CloseableHttpResponse httpResponse;
-
- @Mock
- private HttpEntity httpEntity;
-
- @Mock
- private StatusLine statusLine;
-
- private String readFromResources(String file) throws IOException {
- return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8");
- }
-
- private void setup(String json, int responseCode) throws ClientProtocolException, IOException {
- InputStream content = new ByteArrayInputStream(json.getBytes());
- when(httpClient.execute(any(HttpGet.class))).thenReturn(httpResponse);
- when(httpResponse.getStatusLine()).thenReturn(statusLine);
- when(statusLine.getStatusCode()).thenReturn(responseCode);
- when(httpResponse.getEntity()).thenReturn(httpEntity);
- when(httpEntity.getContent()).thenReturn(content);
- }
-
- @Test
- public void trackTest() throws IOException {
- String json = readFromResources("/trackingResponse.json");
- setup(json, 200);
- UpsEnvironment environment = UpsEnvironment.CIE;
- UpsApi upsApi = new UpsApi(environment, "username", "password", "accessKey");
- UpsResponse upsResponse = upsApi.track("12345", httpClient);
- assertNotNull(upsResponse.getTrackingResponse());
- assertNull(upsResponse.getErrorResponse());
- }
-
- @Test
- public void trackUnknownResponseCodeTest() throws ClientProtocolException, IOException {
- String json = "notRealResponse";
- setup(json, 407);
- UpsEnvironment environment = UpsEnvironment.CIE;
- UpsApi upsApi = new UpsApi(environment, "username", "password", "accessKey");
- UpsResponse upsResponse = upsApi.track("12345", httpClient);
- assertNull(upsResponse.getTrackingResponse());
- assertEquals("Unknown response code 407", upsResponse.getErrorResponse().getErrors().get(0).getMessage());
- }
-
- @Test
- public void trackExceptionThrownTest() throws ClientProtocolException, IOException {
- String json = "notRealResponse";
- setup(json, 200);
- UpsEnvironment environment = UpsEnvironment.CIE;
- UpsApi upsApi = new UpsApi(environment, "username", "password", "accessKey");
- UpsResponse upsResponse = upsApi.track("12345", httpClient);
- assertNull(upsResponse.getTrackingResponse());
- assertEquals("Unable to parse response", upsResponse.getErrorResponse().getErrors().get(0).getMessage());
- }
-
+package io.ljunggren.ups.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.when;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class UpsApiTest {
+
+ @Mock
+ private CloseableHttpClient httpClient;
+
+ @Mock
+ private CloseableHttpResponse httpResponse;
+
+ @Mock
+ private HttpEntity httpEntity;
+
+ @Mock
+ private StatusLine statusLine;
+
+ private String readFromResources(String file) throws IOException {
+ return IOUtils.toString(this.getClass().getResourceAsStream(file), "UTF-8");
+ }
+
+ private void setup(String json, int responseCode) throws ClientProtocolException, IOException {
+ InputStream content = new ByteArrayInputStream(json.getBytes());
+ when(httpClient.execute(Mockito.any(HttpGet.class))).thenReturn(httpResponse);
+ when(httpResponse.getStatusLine()).thenReturn(statusLine);
+ when(statusLine.getStatusCode()).thenReturn(responseCode);
+ when(httpResponse.getEntity()).thenReturn(httpEntity);
+ when(httpEntity.getContent()).thenReturn(content);
+ }
+
+ @Test
+ public void trackTest() throws IOException {
+ String json = readFromResources("/trackingResponse.json");
+ setup(json, 200);
+ UpsEnvironment environment = UpsEnvironment.CIE;
+ UpsApi upsApi = new UpsApi(environment, "username", "password", "accessKey");
+ UpsResponse upsResponse = upsApi.track("12345", httpClient);
+ assertNotNull(upsResponse.getTrackingResponse());
+ assertNull(upsResponse.getErrorResponse());
+ }
+
+ @Test
+ public void trackUnknownResponseCodeTest() throws ClientProtocolException, IOException {
+ String json = "notRealResponse";
+ setup(json, 407);
+ UpsEnvironment environment = UpsEnvironment.CIE;
+ UpsApi upsApi = new UpsApi(environment, "username", "password", "accessKey");
+ UpsResponse upsResponse = upsApi.track("12345", httpClient);
+ assertNull(upsResponse.getTrackingResponse());
+ assertEquals("Unknown response code 407", upsResponse.getErrorResponse().getErrors().get(0).getMessage());
+ }
+
+ @Test
+ public void trackExceptionThrownTest() throws ClientProtocolException, IOException {
+ String json = "notRealResponse";
+ setup(json, 200);
+ UpsEnvironment environment = UpsEnvironment.CIE;
+ UpsApi upsApi = new UpsApi(environment, "username", "password", "accessKey");
+ UpsResponse upsResponse = upsApi.track("12345", httpClient);
+ assertNull(upsResponse.getTrackingResponse());
+ assertEquals("Unable to parse response", upsResponse.getErrorResponse().getErrors().get(0).getMessage());
+ }
+
}
\ No newline at end of file
diff --git a/src/test/resources/trackingResponse.json b/src/test/resources/trackingResponse.json
index 9dd56ab..b67cc0e 100644
--- a/src/test/resources/trackingResponse.json
+++ b/src/test/resources/trackingResponse.json
@@ -1,232 +1,232 @@
-{
- "trackResponse" : {
- "shipment" : [{
- "package" : [{
- "trackingNumber" : "7798339175",
- "deliveryDate" : [{
- "type" : "DEL",
- "date" : "20191003"
- }
- ],
- "deliveryTime" : {
- "startTime" : "",
- "endTime" : "112200",
- "type" : "DEL"
- },
- "activity" : [{
- "location" : {
- "address" : {
- "city" : "Goteborg",
- "stateProvince" : "O",
- "country" : "SE"
- }
- },
- "status" : {
- "description" : "Delivered",
- "code" : "012"
- },
- "date" : "20191003",
- "time" : "112200"
- }, {
- "location" : {
- "address" : {
- "city" : "Goteborg",
- "stateProvince" : "O",
- "country" : "SE"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Arrived at Destination Country",
- "code" : "031"
- },
- "date" : "20191003",
- "time" : "112128"
- }, {
- "location" : {
- "address" : {
- "city" : "Goteborg",
- "stateProvince" : "O",
- "country" : "SE"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Documents to client's broker or consignee",
- "code" : "041"
- },
- "date" : "20191003",
- "time" : "111800"
- }, {
- "location" : {
- "address" : {
- "city" : "Goteborg",
- "stateProvince" : "O",
- "country" : "SE"
- }
- },
- "status" : {
- "type" : "",
- "description" : "ETA at Port of Discharge",
- "code" : "006"
- },
- "date" : "20191003",
- "time" : "063400"
- }, {
- "location" : {
- "address" : {
- "city" : "Goteborg",
- "stateProvince" : "O",
- "country" : "SE"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Confirmed Arrival at Final Carrier B/L Point",
- "code" : "040"
- },
- "date" : "20191003",
- "time" : "063400"
- }, {
- "location" : {
- "address" : {
- "city" : "Goteborg",
- "stateProvince" : "O",
- "country" : "SE"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Confirmed Arrival",
- "code" : "007"
- },
- "date" : "20191003",
- "time" : "063400"
- }, {
- "location" : {
- "address" : {
- "city" : "Rotterdam",
- "stateProvince" : "",
- "country" : "NL"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Departure",
- "code" : "005"
- },
- "date" : "20190929",
- "time" : "190000"
- }, {
- "location" : {
- "address" : {
- "city" : "New York",
- "stateProvince" : "NY",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "ETD from Load Port",
- "code" : "004"
- },
- "date" : "20190914",
- "time" : "120000"
- }, {
- "location" : {
- "address" : {
- "city" : "Newark",
- "stateProvince" : "NJ",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Documents received from shipper",
- "code" : "045"
- },
- "date" : "20190909",
- "time" : "111915"
- }, {
- "location" : {
- "address" : {
- "city" : "Newark",
- "stateProvince" : "NJ",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Date Available to Ship",
- "code" : "003"
- },
- "date" : "20190909",
- "time" : "111915"
- }, {
- "location" : {
- "address" : {
- "city" : "Newark",
- "stateProvince" : "NJ",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Held at customs",
- "code" : "A3"
- },
- "date" : "20190909",
- "time" : "110101"
- }, {
- "location" : {
- "address" : {
- "city" : "Newark",
- "stateProvince" : "NJ",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Planned pickup date",
- "code" : "072"
- },
- "date" : "20190906",
- "time" : "000100"
- }, {
- "location" : {
- "address" : {
- "city" : "Newark",
- "stateProvince" : "NJ",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Received into UPS possession",
- "code" : "002"
- },
- "date" : "20190906",
- "time" : "000100"
- }, {
- "location" : {
- "address" : {
- "city" : "Newark",
- "stateProvince" : "NJ",
- "country" : "US"
- }
- },
- "status" : {
- "type" : "",
- "description" : "Booking Received from Client",
- "code" : "037"
- },
- "date" : "20190829",
- "time" : "202645"
- }
- ]
- }
- ]
- }
- ]
- }
+{
+ "trackResponse" : {
+ "shipment" : [{
+ "package" : [{
+ "trackingNumber" : "7798339175",
+ "deliveryDate" : [{
+ "type" : "DEL",
+ "date" : "20191003"
+ }
+ ],
+ "deliveryTime" : {
+ "startTime" : "",
+ "endTime" : "112200",
+ "type" : "DEL"
+ },
+ "activity" : [{
+ "location" : {
+ "address" : {
+ "city" : "Goteborg",
+ "stateProvince" : "O",
+ "country" : "SE"
+ }
+ },
+ "status" : {
+ "description" : "Delivered",
+ "code" : "012"
+ },
+ "date" : "20191003",
+ "time" : "112200"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Goteborg",
+ "stateProvince" : "O",
+ "country" : "SE"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Arrived at Destination Country",
+ "code" : "031"
+ },
+ "date" : "20191003",
+ "time" : "112128"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Goteborg",
+ "stateProvince" : "O",
+ "country" : "SE"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Documents to client's broker or consignee",
+ "code" : "041"
+ },
+ "date" : "20191003",
+ "time" : "111800"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Goteborg",
+ "stateProvince" : "O",
+ "country" : "SE"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "ETA at Port of Discharge",
+ "code" : "006"
+ },
+ "date" : "20191003",
+ "time" : "063400"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Goteborg",
+ "stateProvince" : "O",
+ "country" : "SE"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Confirmed Arrival at Final Carrier B/L Point",
+ "code" : "040"
+ },
+ "date" : "20191003",
+ "time" : "063400"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Goteborg",
+ "stateProvince" : "O",
+ "country" : "SE"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Confirmed Arrival",
+ "code" : "007"
+ },
+ "date" : "20191003",
+ "time" : "063400"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Rotterdam",
+ "stateProvince" : "",
+ "country" : "NL"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Departure",
+ "code" : "005"
+ },
+ "date" : "20190929",
+ "time" : "190000"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "New York",
+ "stateProvince" : "NY",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "ETD from Load Port",
+ "code" : "004"
+ },
+ "date" : "20190914",
+ "time" : "120000"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Newark",
+ "stateProvince" : "NJ",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Documents received from shipper",
+ "code" : "045"
+ },
+ "date" : "20190909",
+ "time" : "111915"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Newark",
+ "stateProvince" : "NJ",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Date Available to Ship",
+ "code" : "003"
+ },
+ "date" : "20190909",
+ "time" : "111915"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Newark",
+ "stateProvince" : "NJ",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Held at customs",
+ "code" : "A3"
+ },
+ "date" : "20190909",
+ "time" : "110101"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Newark",
+ "stateProvince" : "NJ",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Planned pickup date",
+ "code" : "072"
+ },
+ "date" : "20190906",
+ "time" : "000100"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Newark",
+ "stateProvince" : "NJ",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Received into UPS possession",
+ "code" : "002"
+ },
+ "date" : "20190906",
+ "time" : "000100"
+ }, {
+ "location" : {
+ "address" : {
+ "city" : "Newark",
+ "stateProvince" : "NJ",
+ "country" : "US"
+ }
+ },
+ "status" : {
+ "type" : "",
+ "description" : "Booking Received from Client",
+ "code" : "037"
+ },
+ "date" : "20190829",
+ "time" : "202645"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
}
\ No newline at end of file