Skip to content

Commit 997b91f

Browse files
author
Chris Wilson
committed
Fixes issue #78 - Remove @deprecated from RestConnection.get(EndPoint)
1 parent f4e4a5f commit 997b91f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

libs/sparkpost-lib/src/main/java/com/sparkpost/transport/RestConnection.java

-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ public Response get(String path) throws SparkPostException {
471471
* @see com.sparkpost.transport.IRestConnection#get(com.sparkpost.resources.Endpoint)
472472
*/
473473
@Override
474-
@Deprecated
475474
public Response get(Endpoint endpoint) throws SparkPostException {
476475
Response response = new Response();
477476
return doHttpMethod(endpoint, Method.GET, null, response);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
package com.sparkpost.transport;
3+
4+
import org.junit.Assert;
5+
import org.junit.Test;
6+
7+
public class RestConnectionTest {
8+
9+
@Test
10+
public void constructWithNullBaseURL() throws Exception {
11+
RestConnection restConnection = new RestConnection(null, null);
12+
Assert.assertEquals(IRestConnection.defaultApiEndpoint, restConnection.getBaseUrl());
13+
}
14+
15+
@Test
16+
public void constructWithEmptyBaseURL() throws Exception {
17+
RestConnection restConnection = new RestConnection(null, "");
18+
Assert.assertEquals(IRestConnection.defaultApiEndpoint, restConnection.getBaseUrl());
19+
}
20+
21+
@Test(expected = IllegalStateException.class)
22+
public void constructWithInvalidBaseURL() throws Exception {
23+
RestConnection restConnection = new RestConnection(null, "/");
24+
Assert.assertEquals(IRestConnection.defaultApiEndpoint, restConnection.getBaseUrl());
25+
}
26+
27+
@Test
28+
public void constructWithValidBaseURL() throws Exception {
29+
RestConnection restConnection = new RestConnection(null, "http://foo/bar");
30+
Assert.assertNotEquals(IRestConnection.defaultApiEndpoint, restConnection.getBaseUrl());
31+
Assert.assertEquals("http://foo/bar", restConnection.getBaseUrl());
32+
}
33+
34+
}

0 commit comments

Comments
 (0)