Merge pull request #880 from andrewgaul/fail

Prefer fail over assertTrue(false) where possible
This commit is contained in:
Adrian Cole 2012-10-07 13:19:18 -07:00
commit 79f0361e4a
5 changed files with 13 additions and 15 deletions

View File

@ -24,7 +24,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
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.testng.annotations.BeforeMethod;
@ -76,7 +76,7 @@ public class RetryingCacheLoaderDecoratorTest {
replay(mock);
try {
backoff.load("foo");
assertTrue(false);
fail();
} catch (ResourceNotFoundException e) {
}

View File

@ -23,7 +23,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
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.TimeoutException;
@ -70,7 +70,7 @@ public class BackoffExponentiallyAndRetryOnThrowableCacheLoaderTest {
replay(mock);
try {
backoff.load("foo");
assertTrue(false);
fail();
} catch (ResourceNotFoundException e) {
}
@ -88,7 +88,7 @@ public class BackoffExponentiallyAndRetryOnThrowableCacheLoaderTest {
replay(mock);
try {
backoff.load("foo");
assertTrue(false);
fail();
} catch (TimeoutException e) {
}

View File

@ -23,7 +23,7 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.util.concurrent.Callable;
@ -66,7 +66,7 @@ public class BackoffExponentiallyAndRetryOnThrowableCallableTest {
replay(mock);
try {
backoff.call();
assertTrue(false);
fail();
} catch (ResourceNotFoundException e) {
}

View File

@ -21,8 +21,8 @@ package org.jclouds.internal;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.fail;
import org.jclouds.lifecycle.Closer;
import org.jclouds.providers.ProviderMetadata;
@ -89,7 +89,7 @@ public class BaseViewTest {
assertNotEquals(wine.getBackendType(), TypeToken.of(PeanutButter.class));
try {
wine.unwrap(TypeToken.of(PeanutButter.class));
assertFalse(true);
fail();
} catch (IllegalArgumentException e) {
assertEquals(e.getMessage(), "backend type: org.jclouds.internal.BaseViewTest$Water not assignable from org.jclouds.internal.BaseViewTest$PeanutButter");
}

View File

@ -20,7 +20,7 @@ package org.jclouds.rimuhosting.miro;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.util.Set;
@ -66,11 +66,10 @@ public class RimuHostingClientLiveTest
Set<? extends PricingPlan> plans = connection.getPricingPlanList();
for (PricingPlan plan : plans) {
if (plan.getId().equalsIgnoreCase("MIRO4B")) {
assertTrue(true);
return;
}
}
assertTrue(false);
fail("MIRO4B not found");
}
@Test
@ -78,11 +77,10 @@ public class RimuHostingClientLiveTest
Set<? extends Image> images = connection.getImageList();
for (Image image : images) {
if (image.getId().equalsIgnoreCase("lenny")) {
assertTrue(true);
return;
}
}
assertTrue(false, "lenny not found");
fail("lenny not found");
}
@Test