mirror of https://github.com/apache/jclouds.git
Prefer fail over assertTrue(false) where possible
This commit is contained in:
parent
e4c03396db
commit
8a0900d6ca
|
@ -24,7 +24,7 @@ import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.testng.Assert.assertSame;
|
import static org.testng.Assert.assertSame;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
@ -76,10 +76,10 @@ public class RetryingCacheLoaderDecoratorTest {
|
||||||
replay(mock);
|
replay(mock);
|
||||||
try {
|
try {
|
||||||
backoff.load("foo");
|
backoff.load("foo");
|
||||||
assertTrue(false);
|
fail();
|
||||||
} catch (ResourceNotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
verify(mock);
|
verify(mock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.testng.Assert.assertSame;
|
import static org.testng.Assert.assertSame;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
@ -70,7 +70,7 @@ public class BackoffExponentiallyAndRetryOnThrowableCacheLoaderTest {
|
||||||
replay(mock);
|
replay(mock);
|
||||||
try {
|
try {
|
||||||
backoff.load("foo");
|
backoff.load("foo");
|
||||||
assertTrue(false);
|
fail();
|
||||||
} catch (ResourceNotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public class BackoffExponentiallyAndRetryOnThrowableCacheLoaderTest {
|
||||||
replay(mock);
|
replay(mock);
|
||||||
try {
|
try {
|
||||||
backoff.load("foo");
|
backoff.load("foo");
|
||||||
assertTrue(false);
|
fail();
|
||||||
} catch (TimeoutException e) {
|
} catch (TimeoutException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class BackoffExponentiallyAndRetryOnThrowableCallableTest {
|
||||||
replay(mock);
|
replay(mock);
|
||||||
try {
|
try {
|
||||||
backoff.call();
|
backoff.call();
|
||||||
assertTrue(false);
|
fail();
|
||||||
} catch (ResourceNotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ package org.jclouds.internal;
|
||||||
import static org.easymock.EasyMock.createMock;
|
import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertFalse;
|
|
||||||
import static org.testng.Assert.assertNotEquals;
|
import static org.testng.Assert.assertNotEquals;
|
||||||
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import org.jclouds.lifecycle.Closer;
|
import org.jclouds.lifecycle.Closer;
|
||||||
import org.jclouds.providers.ProviderMetadata;
|
import org.jclouds.providers.ProviderMetadata;
|
||||||
|
@ -89,7 +89,7 @@ public class BaseViewTest {
|
||||||
assertNotEquals(wine.getBackendType(), TypeToken.of(PeanutButter.class));
|
assertNotEquals(wine.getBackendType(), TypeToken.of(PeanutButter.class));
|
||||||
try {
|
try {
|
||||||
wine.unwrap(TypeToken.of(PeanutButter.class));
|
wine.unwrap(TypeToken.of(PeanutButter.class));
|
||||||
assertFalse(true);
|
fail();
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertEquals(e.getMessage(), "backend type: org.jclouds.internal.BaseViewTest$Water not assignable from org.jclouds.internal.BaseViewTest$PeanutButter");
|
assertEquals(e.getMessage(), "backend type: org.jclouds.internal.BaseViewTest$Water not assignable from org.jclouds.internal.BaseViewTest$PeanutButter");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.rimuhosting.miro;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -66,11 +66,10 @@ public class RimuHostingClientLiveTest
|
||||||
Set<? extends PricingPlan> plans = connection.getPricingPlanList();
|
Set<? extends PricingPlan> plans = connection.getPricingPlanList();
|
||||||
for (PricingPlan plan : plans) {
|
for (PricingPlan plan : plans) {
|
||||||
if (plan.getId().equalsIgnoreCase("MIRO4B")) {
|
if (plan.getId().equalsIgnoreCase("MIRO4B")) {
|
||||||
assertTrue(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue(false);
|
fail("MIRO4B not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -78,11 +77,10 @@ public class RimuHostingClientLiveTest
|
||||||
Set<? extends Image> images = connection.getImageList();
|
Set<? extends Image> images = connection.getImageList();
|
||||||
for (Image image : images) {
|
for (Image image : images) {
|
||||||
if (image.getId().equalsIgnoreCase("lenny")) {
|
if (image.getId().equalsIgnoreCase("lenny")) {
|
||||||
assertTrue(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertTrue(false, "lenny not found");
|
fail("lenny not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue