DATACOUCH-37 - Refactor Deprecated JUnit Asserts.

Removed deprecated methods and changed to Hamcrest.

-=david=-
This commit is contained in:
David Harrigan
2013-10-10 19:05:41 +01:00
committed by Michael Nitschinger
parent 46566b9479
commit fa397759e3
4 changed files with 12 additions and 12 deletions

View File

@@ -50,7 +50,7 @@ public abstract class AbstractMonitor {
}
protected String randomAvailableHostname() {
List<SocketAddress> available = (ArrayList) client.getAvailableServers();
List<SocketAddress> available = (ArrayList<SocketAddress>) client.getAvailableServers();
Collections.shuffle(available);
return ((InetSocketAddress) available.get(0)).getHostName();
}
@@ -60,15 +60,12 @@ public abstract class AbstractMonitor {
*
* @return stats for each node
*/
protected Map<SocketAddress,Map<String,String>> getStats() {
protected Map<SocketAddress, Map<String, String>> getStats() {
return client.getStats();
}
/**
* Returns stats for an individual node.
*
* @param node
* @return
*/
protected Map<String, String> getStats(SocketAddress node) {
return getStats().get(node);

View File

@@ -440,7 +440,7 @@ public class MappingCouchbaseConverterTests {
private Map<String, Boolean> attr1;
private Map<Integer, String> attr2;
private Map<String, Map<String, String>> attr3;
public MapEntity(Map attr0, Map attr1, Map attr2, Map attr3) {
public MapEntity(Map<String, String> attr0, Map<String, Boolean> attr1, Map<Integer, String> attr2, Map<String, Map<String, String>> attr3) {
this.attr0 = attr0;
this.attr1 = attr1;
this.attr2 = attr2;

View File

@@ -25,7 +25,10 @@ import org.springframework.data.couchbase.TestApplicationConfig;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static junit.framework.Assert.assertNotNull;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertFalse;
/**
@@ -51,8 +54,7 @@ public class ClientInfoTests {
@Test
public void hostNames() {
String hostnames = ci.getHostNames();
assertNotNull(hostnames);
assertFalse(hostnames.isEmpty());
assertThat(hostnames, not(isEmptyString()));
}
}

View File

@@ -25,7 +25,8 @@ import org.springframework.data.couchbase.TestApplicationConfig;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static junit.framework.Assert.assertTrue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
/**
* @author Michael Nitschinger
@@ -49,12 +50,12 @@ public class ClusterInfoTests {
@Test
public void totalRAMAssigned() {
assertTrue(ci.getTotalRAMAssigned() > 0);
assertThat(ci.getTotalRAMAssigned(), greaterThan(0L));
}
@Test
public void totalRAMUsed() {
assertTrue(ci.getTotalRAMUsed() > 0);
assertThat(ci.getTotalRAMUsed(), greaterThan(0L));
}
}