Skip to content

Commit 41a0c09

Browse files
committed
pom and test case update
1 parent b372b92 commit 41a0c09

3 files changed

Lines changed: 28 additions & 18 deletions

File tree

pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
2+
<!--
33
Title : Java Bindings for DigitalOcean API's
44
Copyright : (c) Jeevanandam (jeeva@myjeeva.com)
5-
@filename : pom.xml
5+
@filename : pom.xml
66
@author : <a href="jeeva@myjeeva.com">Jeevanandam M.</a>
77
@date : Jun 28, 2013 11:20:42 PM GMT+05:30
88
-->
@@ -24,7 +24,7 @@
2424
<licenses>
2525
<license>
2626
<name>The MIT License (MIT)</name>
27-
<url>http://www.opensource.org/licenses/mit-license.php</url>
27+
<url>https://github.com/jeevatkm/digitalocean-api-java/blob/master/LICENSE</url>
2828
<distribution>repo</distribution>
2929
</license>
3030
</licenses>
@@ -70,9 +70,9 @@
7070
<version>1.7.12</version>
7171
</dependency>
7272
<dependency>
73-
<groupId>com.googlecode.jmockit</groupId>
73+
<groupId>org.jmockit</groupId>
7474
<artifactId>jmockit</artifactId>
75-
<version>1.7</version>
75+
<version>1.8</version>
7676
<scope>test</scope>
7777
</dependency>
7878
<dependency>
@@ -126,4 +126,3 @@
126126
</pluginManagement>
127127
</build>
128128
</project>
129-

src/test/java/com/myjeeva/digitalocean/DigitalOceanIntegrationTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@
2020
*/
2121
package com.myjeeva.digitalocean;
2222

23+
import static org.junit.Assert.assertEquals;
24+
import static org.junit.Assert.assertFalse;
25+
import static org.junit.Assert.assertNotNull;
26+
import static org.junit.Assert.assertTrue;
27+
2328
import java.util.ArrayList;
2429
import java.util.Arrays;
2530
import java.util.List;
2631

2732
import org.junit.Ignore;
2833
import org.junit.Test;
34+
import org.junit.runner.RunWith;
35+
import org.junit.runners.JUnit4;
2936
import org.slf4j.Logger;
3037
import org.slf4j.LoggerFactory;
3138

@@ -78,8 +85,6 @@
7885
import com.myjeeva.digitalocean.pojo.Volume;
7986
import com.myjeeva.digitalocean.pojo.Volumes;
8087

81-
import junit.framework.TestCase;
82-
8388
/**
8489
* <p>
8590
* Junit Integration Test case for DigitalOcean API client wrapper methods
@@ -94,7 +99,8 @@
9499
*/
95100
@Ignore
96101
// Marked as Ignore since its a Integration Test case with real values
97-
public class DigitalOceanIntegrationTest extends TestCase {
102+
@RunWith(JUnit4.class)
103+
public class DigitalOceanIntegrationTest {
98104

99105
private final Logger log = LoggerFactory.getLogger(DigitalOceanIntegrationTest.class);
100106

src/test/java/com/myjeeva/digitalocean/DigitalOceanMockTest.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,47 @@
11
package com.myjeeva.digitalocean;
22

3+
import static org.junit.Assert.assertEquals;
4+
35
import java.net.MalformedURLException;
46
import java.net.URISyntaxException;
57
import java.net.URL;
68

7-
import junit.framework.TestCase;
8-
import mockit.Expectations;
9-
import mockit.Mocked;
10-
119
import org.apache.http.HttpVersion;
1210
import org.apache.http.client.methods.HttpUriRequest;
1311
import org.apache.http.entity.ContentType;
1412
import org.apache.http.entity.StringEntity;
1513
import org.apache.http.impl.client.CloseableHttpClient;
1614
import org.apache.http.impl.execchain.PublicHttpResponseProxy;
1715
import org.apache.http.message.BasicHttpResponse;
16+
import org.junit.Test;
17+
import org.junit.runner.RunWith;
18+
import org.junit.runners.JUnit4;
1819

1920
import com.myjeeva.digitalocean.impl.DigitalOceanClient;
2021

22+
import mockit.Expectations;
23+
import mockit.Mocked;
24+
2125
@SuppressWarnings("unused")
22-
public class DigitalOceanMockTest extends TestCase {
26+
@RunWith(JUnit4.class)
27+
public class DigitalOceanMockTest {
2328

2429
private @Mocked CloseableHttpClient defaultHttpClient;
2530

31+
@Test
2632
public void testSnapshotWithName() throws Exception {
2733

2834
new Expectations() {
2935
{
30-
defaultHttpClient.execute((HttpUriRequest) with(new Object() {
36+
defaultHttpClient.execute((HttpUriRequest)with(new Object() {
3137

3238
void validate(HttpUriRequest httpUriRequest) throws MalformedURLException,
3339
URISyntaxException {
3440
assertEquals(new URL("https://api.digitalocean.com/v2/droplets/1234/actions").toURI(),
3541
httpUriRequest.getURI());
3642
}
3743
}));
44+
3845
BasicHttpResponse basicHttpResponse = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "");
3946
basicHttpResponse
4047
.setEntity(new StringEntity(
@@ -43,7 +50,7 @@ void validate(HttpUriRequest httpUriRequest) throws MalformedURLException,
4350
basicHttpResponse.setHeader("RateLimit-Limit", "1200");
4451
basicHttpResponse.setHeader("RateLimit-Remaining", "900");
4552
basicHttpResponse.setHeader("RateLimit-Reset", "1415984218");
46-
53+
4754
result = new PublicHttpResponseProxy(basicHttpResponse);
4855
}
4956
};
@@ -52,5 +59,3 @@ void validate(HttpUriRequest httpUriRequest) throws MalformedURLException,
5259
digitalOcean.takeDropletSnapshot(1234, "snapshot-name");
5360
}
5461
}
55-
56-

0 commit comments

Comments
 (0)