From bfa3458b9723175ed69e9fd67efbafec73fdf41d Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 4 Nov 2012 13:17:56 -0800 Subject: [PATCH] Prefer specific asserts where possible --- .../cloudfiles/CloudFilesClientLiveTest.java | 3 ++- .../compute/strategy/OptionsConverterTest.java | 2 +- .../features/GlobalCapacityClientLiveTest.java | 7 ++++--- .../features/GlobalHostClientLiveTest.java | 14 ++++++++------ .../features/GlobalOfferingClientLiveTest.java | 2 +- .../features/GlobalPodClientLiveTest.java | 4 ++-- .../features/GlobalStoragePoolClientLiveTest.java | 13 +++++++------ .../features/GlobalVlanClientLiveTest.java | 9 +++++---- .../features/SecurityGroupClientLiveTest.java | 2 +- ...dApplicationArchitecturesEC2ClientLiveTest.java | 3 ++- .../openstack/nova/domain/ServerStatusTest.java | 3 ++- .../ParseAddressesFromJsonResponseTest.java | 6 +++--- ...sActiveStatusPredicateWithResultExpectTest.java | 5 +++-- .../test/java/org/jclouds/s3/S3ClientLiveTest.java | 7 ++++--- .../org/jclouds/s3/services/BucketsLiveTest.java | 3 ++- .../openstack/swift/CommonSwiftClientLiveTest.java | 2 +- .../BindAddInternetServiceToXmlPayloadTest.java | 5 +++-- .../cloud/ListAttachedNicsLiveApiTest.java | 2 +- .../management/features/OSImageApiLiveTest.java | 2 +- .../functions/DiskImageToOperatingSystemTest.java | 3 ++- .../fgcp/services/VirtualDCApiExpectTest.java | 2 +- .../fgcp/services/VirtualDCApiLiveTest.java | 5 +++-- .../fgcp/services/VirtualSystemApiExpectTest.java | 2 +- .../v1_5/features/KeyPairsApiLiveTest.java | 2 +- .../director/v1_5/features/MediaApiLiveTest.java | 2 +- .../director/v1_5/features/NetworkApiLiveTest.java | 3 ++- .../director/v1_5/features/VdcApiLiveTest.java | 3 ++- .../director/v1_5/features/VmApiLiveTest.java | 7 ++++--- .../features/admin/AdminCatalogApiLiveTest.java | 3 ++- .../VirtualBoxComputeServiceAdapterLiveTest.java | 5 +++-- .../compute/VirtualBoxExperimentLiveTest.java | 2 +- .../org/jclouds/virtualbox/domain/VmSpecTest.java | 9 +++++---- .../functions/CreateAndInstallVmLiveTest.java | 6 ++++-- .../virtualbox/util/MachineControllerLiveTest.java | 8 +++++--- .../virtualbox/util/MachineUtilsLiveTest.java | 9 +++++---- .../glesys/features/EmailAccountApiLiveTest.java | 6 +++--- .../jclouds/glesys/features/ServerApiLiveTest.java | 2 +- .../HPCloudObjectStorageClientLiveTest.java | 3 ++- .../jclouds/scriptbuilder/ScriptBuilderTest.java | 2 +- 39 files changed, 102 insertions(+), 76 deletions(-) diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java index b7a22c9eae..b8c09abb77 100644 --- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java +++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java @@ -19,6 +19,7 @@ package org.jclouds.cloudfiles; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.net.URI; @@ -75,7 +76,7 @@ public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest response = globalAdminClient.getCapacityClient().listCapacity(); - assert null != response; - assertTrue(response.size() >= 0); + assertNotNull(response); + assertNotEquals(0, response.size()); int count = 0; for (Capacity capacity : response) { assertTrue(capacity.getCapacityTotal() > 0); assertTrue(capacity.getCapacityUsed() > 0); assertTrue(capacity.getPercentUsed() >= 0); - assertTrue(capacity.getType() != Capacity.Type.UNRECOGNIZED); + assertNotEquals(Capacity.Type.UNRECOGNIZED, capacity.getType()); assertNotNull(capacity.getZoneName()); count++; } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java index c4ba3e0250..0dd741f6b7 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java @@ -19,6 +19,8 @@ package org.jclouds.cloudstack.features; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.util.Set; @@ -80,15 +82,15 @@ public class GlobalHostClientLiveTest extends BaseCloudStackClientLiveTest { } private void checkCluster(Cluster cluster) { - assertTrue(cluster.getId() != null); + assertNotNull(cluster.getId()); assertFalse(Strings.isNullOrEmpty(cluster.getName())); - assertTrue(cluster.getAllocationState() != AllocationState.UNKNOWN); - assertTrue(cluster.getClusterType() != Host.ClusterType.UNKNOWN); + assertNotEquals(AllocationState.UNKNOWN, cluster.getAllocationState()); + assertNotEquals(Host.ClusterType.UNKNOWN, cluster.getClusterType()); assertFalse(Strings.isNullOrEmpty(cluster.getHypervisor())); - assertTrue(cluster.getManagedState() != Cluster.ManagedState.UNRECOGNIZED); - assertTrue(cluster.getPodId() != null); + assertNotEquals(Cluster.ManagedState.UNRECOGNIZED, cluster.getManagedState()); + assertNotNull(cluster.getPodId()); assertFalse(Strings.isNullOrEmpty(cluster.getPodName())); - assertTrue(cluster.getZoneId() != null); + assertNotNull(cluster.getZoneId()); assertFalse(Strings.isNullOrEmpty(cluster.getZoneName())); } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java index a6530ec68a..20a0704515 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java @@ -81,7 +81,7 @@ public class GlobalOfferingClientLiveTest extends BaseCloudStackClientLiveTest { } private void checkServiceOffering(ServiceOffering offering) { - assertTrue(offering.getId() != null); + assertNotNull(offering.getId()); assertEquals(offering.getCpuNumber(), 2); assertEquals(offering.getCpuSpeed(), 1024); assertEquals(offering.getMemory(), 2048); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java index b7e070b660..daa1eba379 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java @@ -64,9 +64,9 @@ public class GlobalPodClientLiveTest extends BaseCloudStackClientLiveTest { ListPodsOptions.Builder.id(pod.getId()))); assertEquals(pod, newDetails); assertEquals(pod, globalAdminClient.getPodClient().getPod(pod.getId())); - assertFalse(pod.getId() == null); + assertNotNull(pod.getId()); assertFalse(Strings.isNullOrEmpty(pod.getName())); - assertFalse(pod.getZoneId() == null); + assertNotNull(pod.getZoneId()); assertFalse(Strings.isNullOrEmpty(pod.getZoneName())); assertFalse(Strings.isNullOrEmpty(pod.getGateway())); assertFalse(Strings.isNullOrEmpty(pod.getNetmask())); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java index e467d741d1..ab2b78333f 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java @@ -19,6 +19,7 @@ package org.jclouds.cloudstack.features; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; @@ -46,17 +47,17 @@ public class GlobalStoragePoolClientLiveTest extends BaseCloudStackClientLiveTes assertNotNull(result); assertTrue(result.size() > 0); for(StoragePool pool : result) { - assertTrue(pool.getId() != null); + assertNotNull(pool.getId()); assertFalse(Strings.isNullOrEmpty(pool.getName())); assertFalse(Strings.isNullOrEmpty(pool.getPath())); assertNotNull(pool.getTags()); - assertTrue(pool.getState() != StoragePool.State.UNRECOGNIZED); - assertTrue(pool.getType() != StoragePool.Type.UNRECOGNIZED); - assertTrue(pool.getZoneId() != null); + assertNotEquals(StoragePool.State.UNRECOGNIZED, pool.getState()); + assertNotEquals(StoragePool.Type.UNRECOGNIZED, pool.getType()); + assertNotNull(pool.getZoneId()); assertFalse(Strings.isNullOrEmpty(pool.getZoneName())); - assertTrue(pool.getPodId() != null); + assertNotNull(pool.getPodId()); assertFalse(Strings.isNullOrEmpty(pool.getPodName())); - assertTrue(pool.getClusterId() != null); + assertNotNull(pool.getClusterId()); assertFalse(Strings.isNullOrEmpty(pool.getClusterName())); assertNotNull(pool.getCreated()); assertTrue(pool.getDiskSizeTotal() > 0); diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java index 26835e2a6f..3e62987dc9 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java @@ -22,6 +22,7 @@ import static com.google.common.collect.Iterables.find; import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.zoneId; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import java.util.Set; @@ -71,17 +72,17 @@ public class GlobalVlanClientLiveTest extends BaseCloudStackClientLiveTest { ListVlanIPRangesOptions.Builder.id(range.getId()))); assertEquals(range, newDetails); assertEquals(range, globalAdminClient.getVlanClient().getVlanIPRange(range.getId())); - assertFalse(range.getId() != null); - assertFalse(range.getZoneId() != null); + assertNull(range.getId()); + assertNull(range.getZoneId()); assertFalse(Strings.isNullOrEmpty(range.getVlan())); assertFalse(Strings.isNullOrEmpty(range.getAccount())); - assertFalse(range.getDomainId() != null); + assertNull(range.getDomainId()); assertFalse(Strings.isNullOrEmpty(range.getDomain())); assertFalse(Strings.isNullOrEmpty(range.getGateway())); assertFalse(Strings.isNullOrEmpty(range.getNetmask())); assertFalse(Strings.isNullOrEmpty(range.getStartIP())); assertFalse(Strings.isNullOrEmpty(range.getEndIP())); - assertFalse(range.getNetworkId() != null); + assertNull(range.getNetworkId()); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java index 4b5fe84bf4..31f58d2dab 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java @@ -208,7 +208,7 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest { jobComplete, virtualMachineRunning); try { VirtualMachine runningVm = client.getVirtualMachineClient().getVirtualMachine(newVm.getId()); - assertTrue(runningVm.getSecurityGroups().size() == 1); + assertEquals(1, runningVm.getSecurityGroups().size()); assertEquals(Iterables.getOnlyElement(runningVm.getSecurityGroups()).getName(), "default"); } finally { assertTrue(jobComplete.apply(client.getVirtualMachineClient().destroyVirtualMachine(newVm.getId()))); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ClientLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ClientLiveTest.java index 2b8ccb275d..b8dad7d801 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ClientLiveTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ClientLiveTest.java @@ -22,6 +22,7 @@ import static org.jclouds.ec2.options.RunInstancesOptions.Builder.asType; import static org.jclouds.scriptbuilder.domain.Statements.exec; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; @@ -331,7 +332,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS .describeInstancesInRegion(null, instanceId)); assertNotNull(Iterables.getOnlyElement(reservation).getIpAddress()); - assertFalse(Iterables.getOnlyElement(reservation).getIpAddress().equals(address)); + assertNotEquals(address, Iterables.getOnlyElement(reservation).getIpAddress()); doCheckKey(address); diff --git a/apis/nova/src/test/java/org/jclouds/openstack/nova/domain/ServerStatusTest.java b/apis/nova/src/test/java/org/jclouds/openstack/nova/domain/ServerStatusTest.java index 03911f1a6c..42841a2378 100644 --- a/apis/nova/src/test/java/org/jclouds/openstack/nova/domain/ServerStatusTest.java +++ b/apis/nova/src/test/java/org/jclouds/openstack/nova/domain/ServerStatusTest.java @@ -20,6 +20,7 @@ package org.jclouds.openstack.nova.domain; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertTrue; import java.util.Arrays; @@ -47,7 +48,7 @@ public class ServerStatusTest { "PASSWORD", "RESCUE", "REBOOT", "HARD_REBOOT", "DELETE_IP", "UNKNOWN", "DELETED"); for (String status : knownStatuses) { - assertFalse(ServerStatus.fromValue(status).equals(ServerStatus.UNRECOGNIZED)); + assertNotEquals(ServerStatus.UNRECOGNIZED, ServerStatus.fromValue(status)); } List allStatuses = Lists.newArrayList(knownStatuses); diff --git a/apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseAddressesFromJsonResponseTest.java b/apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseAddressesFromJsonResponseTest.java index a0b0f0ba17..f117009b61 100644 --- a/apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseAddressesFromJsonResponseTest.java +++ b/apis/nova/src/test/java/org/jclouds/openstack/nova/functions/ParseAddressesFromJsonResponseTest.java @@ -18,7 +18,7 @@ */ package org.jclouds.openstack.nova.functions; -import static org.testng.Assert.assertTrue; +import static org.testng.Assert.assertEquals; import java.io.InputStream; import java.net.UnknownHostException; @@ -63,7 +63,7 @@ public class ParseAddressesFromJsonResponseTest { List
privateAddresses = ImmutableList.copyOf(Iterables.transform( ImmutableList.of("10.176.42.16", "::babe:10.176.42.16"), Address.newString2AddressFunction())); - assertTrue(response.getPublicAddresses().equals(Sets.newHashSet(publicAddresses))); - assertTrue(response.getPrivateAddresses().equals(Sets.newHashSet(privateAddresses))); + assertEquals(Sets.newHashSet(publicAddresses), response.getPublicAddresses()); + assertEquals(Sets.newHashSet(privateAddresses), response.getPrivateAddresses()); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/predicates/GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/predicates/GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest.java index 5aad00841a..3e6ad668ff 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/predicates/GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/predicates/GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest.java @@ -20,6 +20,7 @@ package org.jclouds.openstack.nova.v2_0.compute.predicates; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.util.Map; @@ -60,8 +61,8 @@ public class GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest ZoneAndId zoneAdnId1 = ZoneAndId.fromZoneAndId("az-1.region-a.geo-1", "12"); ZoneAndId zoneAdnId2 = ZoneAndId.fromZoneAndId("az-1.region-a.geo-1", "15"); assertTrue(predicate.apply(zoneAdnId0)); // ACTIVE - assertTrue(!predicate.apply(zoneAdnId1)); // SAVING - assertTrue(!predicate.apply(zoneAdnId2)); // UNRECOGNIZED + assertFalse(predicate.apply(zoneAdnId1)); // SAVING + assertFalse(predicate.apply(zoneAdnId2)); // UNRECOGNIZED assertEquals("oneiric-server-cloudimg-amd64", predicate.getResult().getName()); } diff --git a/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java b/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java index b06413eac7..ba38b4eaa6 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/S3ClientLiveTest.java @@ -29,6 +29,7 @@ import static org.jclouds.s3.options.CopyObjectOptions.Builder.overrideMetadataW import static org.jclouds.s3.options.PutObjectOptions.Builder.withAcl; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.io.IOException; @@ -156,7 +157,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest { AccessControlList acl = getApi().getObjectACL(containerName, publicReadWriteObjectKey); assertEquals(acl.getGrants().size(), 3); assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 2); - assertTrue(acl.getOwner() != null); + assertNotNull(acl.getOwner()); String ownerId = acl.getOwner().getId(); assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL)); assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ)); @@ -230,7 +231,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest { AccessControlList acl = getApi().getObjectACL(containerName, privateObjectKey); assertEquals(acl.getGrants().size(), 1); - assertTrue(acl.getOwner() != null); + assertNotNull(acl.getOwner()); String ownerId = acl.getOwner().getId(); assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL)); } finally { @@ -255,7 +256,7 @@ public class S3ClientLiveTest extends BaseBlobStoreIntegrationTest { assertEquals(acl.getGrants().size(), 2); assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 1); - assertTrue(acl.getOwner() != null); + assertNotNull(acl.getOwner()); String ownerId = acl.getOwner().getId(); assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL)); assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ)); diff --git a/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java b/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java index b2bfab9768..70182b69be 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java +++ b/apis/s3/src/test/java/org/jclouds/s3/services/BucketsLiveTest.java @@ -24,6 +24,7 @@ import static org.jclouds.s3.options.ListBucketOptions.Builder.maxResults; import static org.jclouds.s3.options.ListBucketOptions.Builder.withPrefix; import static org.jclouds.s3.options.PutBucketOptions.Builder.withBucketAcl; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; @@ -98,7 +99,7 @@ public class BucketsLiveTest extends BaseBlobStoreIntegrationTest { try { AccessControlList acl = getApi().getBucketACL(bucketName); assertEquals(acl.getGrants().size(), 1); - assertTrue(acl.getOwner() != null); + assertNotNull(acl.getOwner()); String ownerId = acl.getOwner().getId(); assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL)); } finally { diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientLiveTest.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientLiveTest.java index 51a9fdb807..27e209863c 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientLiveTest.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/CommonSwiftClientLiveTest.java @@ -295,7 +295,7 @@ public abstract class CommonSwiftClientLiveTest ext // test that not giving a destination name *doesn't* copy source name to the destination container with // the source name but copy still returns success :( assertTrue(getApi().copyObject(sourceContainer, sourceObject, destinationContainer, "")); - assertTrue(!getApi().objectExists(destinationContainer, sourceObject)); + assertFalse(getApi().objectExists(destinationContainer, sourceObject)); // test copy works assertTrue(getApi().copyObject(sourceContainer, sourceObject, destinationContainer, destinationObject)); diff --git a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java index 090f3d83bc..04fbd38606 100644 --- a/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java +++ b/common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/binders/BindAddInternetServiceToXmlPayloadTest.java @@ -20,6 +20,7 @@ package org.jclouds.trmk.vcloud_0_8.binders; import static org.jclouds.trmk.vcloud_0_8.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NS; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertTrue; import java.io.IOException; @@ -96,7 +97,7 @@ public class BindAddInternetServiceToXmlPayloadTest { binder.bindToRequest(request, map); String rawContent = (String) request.getPayload().getRawContent(); - assertTrue(rawContent.indexOf("Disabled") == -1); + assertEquals(-1, rawContent.indexOf("Disabled")); } public void testDisableMonitoringDisabled() throws IOException { @@ -114,6 +115,6 @@ public class BindAddInternetServiceToXmlPayloadTest { binder.bindToRequest(request, map); String rawContent = (String) request.getPayload().getRawContent(); - assertTrue(rawContent.indexOf("Disabled") != -1); + assertNotEquals(-1, rawContent.indexOf("Disabled")); } } diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListAttachedNicsLiveApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListAttachedNicsLiveApiTest.java index 40b6acbd1c..cceefa27bd 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListAttachedNicsLiveApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/strategy/cloud/ListAttachedNicsLiveApiTest.java @@ -85,7 +85,7 @@ public class ListAttachedNicsLiveApiTest extends BaseAbiquoStrategyLiveApiTest { public void testExecute() { Iterable> vapps = strategy.execute(env.virtualMachine); assertNotNull(vapps); - assertTrue(size(vapps) == 4); + assertEquals(4, size(vapps)); } public void testExecutePredicateWithoutResults() { diff --git a/labs/azure-management/src/test/java/org/jclouds/azure/management/features/OSImageApiLiveTest.java b/labs/azure-management/src/test/java/org/jclouds/azure/management/features/OSImageApiLiveTest.java index a7d0bcd439..bd24459cd5 100644 --- a/labs/azure-management/src/test/java/org/jclouds/azure/management/features/OSImageApiLiveTest.java +++ b/labs/azure-management/src/test/java/org/jclouds/azure/management/features/OSImageApiLiveTest.java @@ -75,7 +75,7 @@ public class OSImageApiLiveTest extends BaseAzureManagementApiLiveTest { checkNotNull(image.getCategory(), "While Category can be null for OSImage, its Optional wrapper cannot: %s", image); if (image.getCategory().isPresent()) - assertFalse(image.getCategory().get().trim().equals(""), "Invalid Category: " + image.toString()); + assertNotEquals("", image.getCategory().get().trim(), "Invalid Category: " + image.toString()); checkNotNull(image.getLogicalSizeInGB(), "While LogicalSizeInGB can be null for OSImage, its Optional wrapper cannot: %s", image); diff --git a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToOperatingSystemTest.java b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToOperatingSystemTest.java index 2c947e569b..557651812e 100644 --- a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToOperatingSystemTest.java +++ b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToOperatingSystemTest.java @@ -2,6 +2,7 @@ package org.jclouds.fujitsu.fgcp.compute.functions; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; @@ -56,7 +57,7 @@ public class DiskImageToOperatingSystemTest { assertNotNull(os, description); assertNotNull(os.getFamily(), description); - assertFalse(os.getFamily().equals(OsFamily.UNRECOGNIZED), + assertNotEquals(OsFamily.UNRECOGNIZED, os.getFamily(), "OsFamily not recognised: " + description); assertNotNull(os.getVersion(), "Version not recognised: " + description); diff --git a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiExpectTest.java b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiExpectTest.java index 32ae3ad2ef..3f21b6c9c5 100644 --- a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiExpectTest.java +++ b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiExpectTest.java @@ -128,7 +128,7 @@ public class VirtualDCApiExpectTest extends BaseFGCPRestApiExpectTest { Set images = api.listDiskImages(null, "IMG_A1B2C3_1234567890ABCD"); assertNotNull(images, "images"); - assertTrue(images.size() == 1, "Unexpected number of images: " + images.size()); + assertEquals(1, images.size(), "Unexpected number of images: " + images.size()); } public void testGetAddressRange() { diff --git a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiLiveTest.java b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiLiveTest.java index 16a5191972..45fade92e7 100644 --- a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiLiveTest.java +++ b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualDCApiLiveTest.java @@ -18,6 +18,7 @@ */ package org.jclouds.fujitsu.fgcp.services; +import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; @@ -59,7 +60,7 @@ public class VirtualDCApiLiveTest extends BaseFGCPApiLiveTest { String vsysId = api.createVirtualSystem("abc", "def"); assertNotNull(vsysId, "vsysId"); - assertFalse(vsysId.equals(""), "vsysId is empty (\"\")"); + assertNotEquals("", vsysId, "vsysId is empty (\"\")"); System.out.println("vsysId: " + vsysId); }*/ @@ -67,7 +68,7 @@ public class VirtualDCApiLiveTest extends BaseFGCPApiLiveTest { Set serverTypes = api.listServerTypes(); assertNotNull(serverTypes, "serverTypes"); - assertTrue(serverTypes.size() == 4, "serverTypes.size should return 4, not " + serverTypes.size()); + assertEquals(4, serverTypes.size(), "serverTypes.size should return 4, not " + serverTypes.size()); // System.out.println("listServerTypes: " + serverTypes); } diff --git a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualSystemApiExpectTest.java b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualSystemApiExpectTest.java index 79fc009811..edebdab47f 100644 --- a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualSystemApiExpectTest.java +++ b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/services/VirtualSystemApiExpectTest.java @@ -113,7 +113,7 @@ public class VirtualSystemApiExpectTest extends BaseFGCPRestApiExpectTest { Set ips = api.listPublicIPs("ABCDEFGH-A123B456CE"); assertNotNull(ips, "ips"); - assertTrue(ips.size() == 2, "Unexpected number of ips: " + ips.size()); + assertEquals(2, ips.size(), "Unexpected number of ips: " + ips.size()); assertEquals(ips.iterator().next().getVersion(), PublicIP.Version.IPv4); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java index d654568d9c..80dac4e36c 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/KeyPairsApiLiveTest.java @@ -143,7 +143,7 @@ public class KeyPairsApiLiveTest extends BaseVCloudDirectorApiLiveTest { keyPairsContainerName); assertNotNull(keyPairsContainer.getFiles(), String.format(OBJ_FIELD_REQ, MEDIA, "files")); - assertTrue(keyPairsContainer.getFiles().size() == 1, String.format( + assertEquals(1, keyPairsContainer.getFiles().size(), String.format( OBJ_FIELD_LIST_SIZE_EQ, MEDIA, "files", 1, keyPairsContainer .getFiles().size())); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java index 31217a249a..658ef690df 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaApiLiveTest.java @@ -138,7 +138,7 @@ public class MediaApiLiveTest extends BaseVCloudDirectorApiLiveTest { Checks.checkMediaFor(MEDIA, media); assertNotNull(media.getFiles(), String.format(OBJ_FIELD_REQ, MEDIA, "files")); - assertTrue(media.getFiles().size() == 1, + assertEquals(1, media.getFiles().size(), String.format(OBJ_FIELD_LIST_SIZE_EQ, MEDIA, "files", 1, media.getFiles().size())); File uploadFile = getFirst(media.getFiles(), null); assertNotNull(uploadFile, String.format(OBJ_FIELD_REQ, MEDIA, "files.first")); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java index 76af7d9358..11075e88c7 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkApiLiveTest.java @@ -27,6 +27,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.U import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResource; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; @@ -88,7 +89,7 @@ public class NetworkApiLiveTest extends BaseVCloudDirectorApiLiveTest { String.format(REQUIRED_VALUE_OBJECT_FMT, ".class", NETWORK, abstractNetwork.getClass(), "OrgNetwork")); OrgNetwork network = Network.toSubType(abstractNetwork); assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK)); - assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing"); + assertNotEquals("DO NOT USE", network.getDescription(), "Network isn't to be used for testing"); Checks.checkOrgNetwork(network); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java index 93e1bed3db..38e1f430d7 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcApiLiveTest.java @@ -24,6 +24,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.O import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.URN_REQ_LIVE; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -134,7 +135,7 @@ public class VdcApiLiveTest extends BaseVCloudDirectorApiLiveTest { public void testGetVdc() { Vdc vdc = lazyGetVdc(); assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC)); - assertFalse("DO NOT USE".equals(vdc.getDescription()), "vDC isn't to be used for testing"); + assertNotEquals("DO NOT USE", vdc.getDescription(), "vDC isn't to be used for testing"); Checks.checkVdc(vdc); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java index e661a733ee..df2e3d6717 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VmApiLiveTest.java @@ -41,6 +41,7 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; import java.math.BigInteger; @@ -451,9 +452,9 @@ public class VmApiLiveTest extends AbstractVAppApiLiveTest { for (NetworkConnection connection : modified.getNetworkConnections()) { if (connection.getNetwork().equals( newNetworkConnection.getNetwork())) { - assertTrue(connection.getIpAddressAllocationMode().equals( - newNetworkConnection.getIpAddressAllocationMode())); - assertTrue(connection.getNetworkConnectionIndex() == newNetworkConnection + assertEquals(connection.getIpAddressAllocationMode(), + newNetworkConnection.getIpAddressAllocationMode()); + assertSame(connection.getNetworkConnectionIndex(), newNetworkConnection .getNetworkConnectionIndex()); } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java index b562471e25..f13ca66eb1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApiLiveTest.java @@ -24,6 +24,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.O import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; @@ -176,7 +177,7 @@ public class AdminCatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest { @Test(description = "POST /admin/catalog/{id}/action/publish", dependsOnMethods = { "testEditCatalog" }) public void testPublishCatalog() { assertNotNull(catalog, String.format(NOT_NULL_OBJ_FMT, "Catalog")); - assertTrue(!catalog.isPublished(), + assertFalse(catalog.isPublished(), String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", false, catalog.isPublished())); PublishCatalogParams params = PublishCatalogParams.builder().isPublished(true).build(); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java index 7cdee2d010..37af77d2a2 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java @@ -21,6 +21,7 @@ package org.jclouds.virtualbox.compute; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import javax.inject.Inject; @@ -78,13 +79,13 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien @Test public void testListHardwareProfiles() { Iterable profiles = adapter.listHardwareProfiles(); - assertTrue(!Iterables.isEmpty(profiles)); + assertFalse(Iterables.isEmpty(profiles)); } @Test public void testListImages() { Iterable iMageIterable = adapter.listImages(); - assertTrue(!Iterables.isEmpty(iMageIterable)); + assertFalse(Iterables.isEmpty(iMageIterable)); } @AfterClass diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java index 3153338bff..8fdf558ce8 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java @@ -75,7 +75,7 @@ public class VirtualBoxExperimentLiveTest extends BaseVirtualBoxClientLiveTest { TemplateOptions.Builder.overrideLoginUser("toor").runScript(AdminAccess.standard())); assertEquals(numNodes, nodes.size(), "wrong number of nodes"); for (NodeMetadata node : nodes) { - assertTrue(node.getGroup().equals("test-launch-cluster")); + assertEquals("test-launch-cluster", node.getGroup()); logger.debug("Created Node: %s", node); SshClient client = context.utils().sshForNode().apply(node); client.connect(); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java index 8d9ec5d11c..c573080281 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/domain/VmSpecTest.java @@ -21,6 +21,7 @@ package org.jclouds.virtualbox.domain; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; @@ -39,28 +40,28 @@ public class VmSpecTest { public void testEqualsWrongId() throws Exception { VmSpec vmSpec = defaultVm().build(); VmSpec other = defaultVm().id("OtherVMId").build(); - assertFalse(vmSpec.equals(other)); + assertNotEquals(vmSpec, other); } @Test public void testEqualsWrongName() throws Exception { VmSpec vmSpec = defaultVm().build(); VmSpec other = defaultVm().name("OtherName").build(); - assertFalse(vmSpec.equals(other)); + assertNotEquals(vmSpec, other); } @Test public void testEqualsWrongOsType() throws Exception { VmSpec vmSpec = defaultVm().build(); VmSpec other = defaultVm().osTypeId("OtherOS").build(); - assertFalse(vmSpec.equals(other)); + assertNotEquals(vmSpec, other); } @Test public void testEqualsWrongForceOverwriteRule() throws Exception { VmSpec vmSpec = defaultVm().build(); VmSpec other = defaultVm().forceOverwrite(false).build(); - assertFalse(vmSpec.equals(other)); + assertNotEquals(vmSpec, other); } private VmSpec.Builder defaultVm() { diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index bd25a24cff..35e201e278 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -22,7 +22,8 @@ package org.jclouds.virtualbox.functions; import static com.google.common.base.Preconditions.checkState; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; -import static org.testng.Assert.assertTrue; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertFalse; import java.net.URI; import java.util.Map; @@ -136,7 +137,8 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { String version = machine.getGuestPropertyValue("/VirtualBox/GuestAdd/Version"); - assertTrue(version != null && !version.isEmpty()); + assertNotNull(version); + assertFalse(version.isEmpty()); } finally { for (VmSpec spec : ImmutableSet.of(machineSpec.getVmSpec())) { machineController.ensureMachineIsShutdown(spec.getVmName()); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java index 57534d9217..ba20069bae 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java @@ -21,6 +21,8 @@ package org.jclouds.virtualbox.util; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; import org.jclouds.config.ValueOfConfigurationKeyOrNull; @@ -102,16 +104,16 @@ public class MachineControllerLiveTest extends BaseVirtualBoxClientLiveTest { public void testEnsureMachineisLaunchedAndSessionIsUnlocked() { cloneFromMaster(); ISession cloneMachineSession = machineController.ensureMachineIsLaunched(instanceName); - assertTrue(cloneMachineSession.getState() == SessionState.Unlocked); + assertSame(cloneMachineSession.getState(), SessionState.Unlocked); cloneMachineSession = machineController.ensureMachineHasPowerDown(instanceName); - assertTrue(cloneMachineSession.getState() == SessionState.Unlocked); + assertSame(cloneMachineSession.getState(), SessionState.Unlocked); } @Test(dependsOnMethods="testEnsureMachineisLaunchedAndSessionIsUnlocked") public void testEnsureMachineCanBePoweredOffMoreThanOneTimeAndSessionIsUnlocked() { ISession cloneMachineSession = machineController.ensureMachineHasPowerDown(instanceName); SessionState state = cloneMachineSession.getState(); - assertTrue(state.equals(SessionState.Unlocked)); + assertEquals(SessionState.Unlocked, state); } private IMachine cloneFromMaster() { diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java index af69bc2732..1ae91601fc 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineUtilsLiveTest.java @@ -22,6 +22,7 @@ package org.jclouds.virtualbox.util; import static com.google.common.base.Preconditions.checkState; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; +import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; import org.jclouds.config.ValueOfConfigurationKeyOrNull; @@ -100,7 +101,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest { new Function() { @Override public ISession apply(ISession session) { - assertTrue(session.getMachine().getName().equals(clone.getName())); + assertEquals(session.getMachine().getName(), clone.getName()); return session; } }); @@ -115,7 +116,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest { new Function() { @Override public ISession apply(ISession session) { - assertTrue(session.getMachine().getName().equals(clone.getName())); + assertEquals(session.getMachine().getName(), clone.getName()); return session; } }); @@ -148,7 +149,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest { @Override public ISession apply(ISession sharedSession) { checkState(sharedSession.getState().equals(SessionState.Locked)); - assertTrue(sharedSession.getMachine().getName().equals(clone.getName())); + assertEquals(sharedSession.getMachine().getName(), clone.getName()); return sharedSession; } }); @@ -173,7 +174,7 @@ public class MachineUtilsLiveTest extends BaseVirtualBoxClientLiveTest { @Override public ISession apply(ISession writeSession) { checkState(writeSession.getState().equals(SessionState.Locked)); - assertTrue(writeSession.getMachine().getName().equals(clone.getName())); + assertEquals(writeSession.getMachine().getName(), clone.getName()); return writeSession; } }); diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java index 2fc3bbc53c..86a8b7d7c7 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/EmailAccountApiLiveTest.java @@ -112,18 +112,18 @@ public class EmailAccountApiLiveTest extends BaseGleSYSApiLiveTest { assertEquals(aliasFromList, alias); EmailOverview overview = api.getOverview(); - assertTrue(overview.getSummary().getAliases() == 1); + assertEquals(1, overview.getSummary().getAliases()); alias = api.updateAlias("test2@" + testDomain, "test1@" + testDomain); overview = api.getOverview(); - assertTrue(overview.getSummary().getAliases() == 1); + assertEquals(1, overview.getSummary().getAliases()); aliasFromList = Iterables.getOnlyElement(api.listAliasesInDomain(testDomain)); assertEquals(aliasFromList, alias); api.delete("test2@" + testDomain); overview = api.getOverview(); - assertTrue(overview.getSummary().getAliases() == 0); + assertEquals(0, overview.getSummary().getAliases()); } @Test(dependsOnMethods = "testCreateEmail") diff --git a/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java b/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java index 3de28e41a6..34c691fa5e 100644 --- a/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java +++ b/providers/glesys/src/test/java/org/jclouds/glesys/features/ServerApiLiveTest.java @@ -201,7 +201,7 @@ public class ServerApiLiveTest extends BaseGleSYSApiWithAServerLiveTest { assertNotNull(entry.getValue()); ServerLimit limit = entry.getValue(); assertTrue(limit.getBarrier() >= 0); - assertTrue(limit.getFailCount() == 0); + assertEquals(0, limit.getFailCount()); assertTrue(limit.getHeld() >= 0); assertTrue(limit.getLimit() > 0); assertTrue(limit.getMaxHeld() >= 0); diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java index ccb1918f23..083d01e6cd 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageClientLiveTest.java @@ -19,6 +19,7 @@ package org.jclouds.hpcloud.objectstorage; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import java.net.URI; @@ -71,7 +72,7 @@ public class HPCloudObjectStorageClientLiveTest extends CommonSwiftClientLiveTes // Enable CDN with PUT for one container final URI cdnUri = getApi().getCDNExtension().get().enable(containerNameWithCDN); - assertTrue(cdnUri != null); + assertNotNull(cdnUri); // Confirm CDN is enabled via HEAD request and has default TTL cdnMetadata = getApi().getCDNExtension().get().get(containerNameWithCDN); diff --git a/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java index 61177e10fe..f45ae0fc45 100644 --- a/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java +++ b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/ScriptBuilderTest.java @@ -152,7 +152,7 @@ public class ScriptBuilderTest { Utils.writeFunctionFromResource("abort", OsFamily.UNIX)); for (String fn : defaultFunctions.values()) { - assertTrue(fn.indexOf("\r\n") == -1, "windows linefeeds!"); + assertEquals(-1, fn.indexOf("\r\n"), "windows linefeeds!"); } Map resolvedFunctions = ScriptBuilder.resolveFunctionDependenciesForStatements(defaultFunctions,