Address error-prone errors

Mostly of the form, Collection.size() >= 0.
This commit is contained in:
Andrew Gaul 2015-07-30 15:21:42 -07:00
parent ba55ab4b12
commit 98b3105669
20 changed files with 24 additions and 24 deletions

View File

@ -71,7 +71,7 @@ public class AddressApiLiveTest extends BaseCloudStackApiLiveTest {
return;
Set<PublicIPAddress> response = client.getAddressApi().listPublicIPAddresses();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (PublicIPAddress ip : response) {
PublicIPAddress newDetails = getOnlyElement(client.getAddressApi().listPublicIPAddresses(
ListPublicIPAddressesOptions.Builder.id(ip.getId())));

View File

@ -33,7 +33,7 @@ public class EventApiLiveTest extends BaseCloudStackApiLiveTest {
public void testlistEventTypes() throws Exception {
final Set<String> response = client.getEventApi().listEventTypes();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (String type : response) {
checkEventType(type);
}
@ -42,7 +42,7 @@ public class EventApiLiveTest extends BaseCloudStackApiLiveTest {
public void testlistEvents() throws Exception {
final Set<Event> response = client.getEventApi().listEvents();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (Event event : response) {
checkEvent(event);
}

View File

@ -115,7 +115,7 @@ public class FirewallApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListPortForwardingRules() throws Exception {
Set<PortForwardingRule> response = client.getFirewallApi().listPortForwardingRules();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (final PortForwardingRule rule : response) {
checkPortForwardingRule(rule);
}

View File

@ -38,7 +38,7 @@ public class GlobalAlertApiLiveTest extends BaseCloudStackApiLiveTest {
final Set<Alert> response = globalAdminClient.getAlertClient().listAlerts();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
int count = 0;
for (Alert alert : response) {
assertNotNull(alert.getDescription());

View File

@ -52,7 +52,7 @@ public class GlobalUsageApiLiveTest extends BaseCloudStackApiLiveTest {
Set<UsageRecord> records = globalAdminClient.getUsageClient().listUsageRecords(start, end, ListUsageRecordsOptions.NONE);
assertNotNull(records);
assertTrue(records.size() >= 0);
assertTrue(records.size() > 0);
}
}

View File

@ -38,7 +38,7 @@ public class GuestOSApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListOSTypes() throws Exception {
Set<OSType> response = client.getGuestOSApi().listOSTypes();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (OSType type : response) {
OSType newDetails = getOnlyElement(client.getGuestOSApi().listOSTypes(
ListOSTypesOptions.Builder.id(type.getId())));
@ -50,7 +50,7 @@ public class GuestOSApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListOSCategories() throws Exception {
Map<String, String> response = client.getGuestOSApi().listOSCategories();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (Entry<String, String> category : response.entrySet()) {
checkOSCategory(category);
}

View File

@ -33,7 +33,7 @@ public class HypervisorApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListHypervisors() throws Exception {
Set<String> response = client.getHypervisorApi().listHypervisors();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (Zone zone : client.getZoneApi().listZones()) {
Set<String> zoneHype = client.getHypervisorApi().listHypervisorsInZone(zone.getId());
assert response.containsAll(zoneHype);

View File

@ -191,7 +191,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListLoadBalancerRules() throws Exception {
Set<LoadBalancerRule> response = client.getLoadBalancerApi().listLoadBalancerRules();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (LoadBalancerRule rule : response) {
LoadBalancerRule newDetails = findRuleWithId(rule.getId());
assertEquals(rule.getId(), newDetails.getId());

View File

@ -38,7 +38,7 @@ public class NATApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListIPForwardingRules() throws Exception {
Set<IPForwardingRule> response = client.getNATApi().listIPForwardingRules();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (IPForwardingRule rule : response) {
IPForwardingRule newDetails = getOnlyElement(client.getNATApi().listIPForwardingRules(
ListIPForwardingRulesOptions.Builder.id(rule.getId())));

View File

@ -335,7 +335,7 @@ public class VirtualMachineApiLiveTest extends BaseCloudStackApiLiveTest {
public void testListVirtualMachines() throws Exception {
Set<VirtualMachine> response = client.getVirtualMachineApi().listVirtualMachines();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (VirtualMachine vm : response) {
VirtualMachine newDetails = getOnlyElement(client.getVirtualMachineApi().listVirtualMachines(
ListVirtualMachinesOptions.Builder.id(vm.getId())));
@ -392,7 +392,7 @@ public class VirtualMachineApiLiveTest extends BaseCloudStackApiLiveTest {
}
}
assert vm.getSecurityGroups() != null && vm.getSecurityGroups().size() >= 0 : vm;
assert vm.getSecurityGroups() != null && vm.getSecurityGroups().size() > 0 : vm;
assert vm.getHypervisor() != null : vm;
}
}

View File

@ -58,8 +58,8 @@ public class ZoneApiLiveTest extends BaseCloudStackApiLiveTest {
break;
case BASIC:
assert zone.getVLAN() == null : zone;
assert zone.getDNS().size() >= 0 : zone;
assert zone.getInternalDNS().size() >= 0 : zone;
assert zone.getDNS().size() > 0 : zone;
assert zone.getInternalDNS().size() > 0 : zone;
assert zone.getDomain() == null : zone;
assert zone.getDomainId() == null : zone;
assert zone.getGuestCIDRAddress() == null : zone;

View File

@ -113,7 +113,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, floatingIpPoolNames, generateKeyPair, keyPairName,
userData, diskConfig, configDrive, novaNetworks, availabilityZone);
Arrays.hashCode(userData), diskConfig, configDrive, novaNetworks, availabilityZone);
}
@Override

View File

@ -50,7 +50,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
FloatingIPApi api = apiOption.get();
Set<? extends FloatingIP> response = api.list().toSet();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (FloatingIP ip : response) {
FloatingIP newDetails = api.get(ip.getId());

View File

@ -109,7 +109,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
Set<LoadBalancer> response = api.getLoadBalancerApi(region).list().concat().toSet();
assertNotNull(response);
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (LoadBalancer lb : response) {
if (!lbs.contains(lb))

View File

@ -107,7 +107,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
for (LoadBalancer lb : nodes.keySet()) {
Set<Node> response = api.getNodeApi(lb.getRegion(), lb.getId()).list().concat().toSet();
assert null != response;
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (Node n : response) {
assert n.getId() != -1 : n;
assert n.getCondition() != null : n;

View File

@ -844,7 +844,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
for (Hardware hardware : client.listHardwareProfiles()) {
assert hardware.getProviderId() != null : hardware;
assert getCores(hardware) > 0 : hardware;
assert hardware.getVolumes().size() >= 0 : hardware;
assert hardware.getVolumes().size() > 0 : hardware;
assert hardware.getRam() > 0 : hardware;
assertEquals(hardware.getType(), ComputeType.HARDWARE);
}

View File

@ -52,7 +52,7 @@ public class AWSInstanceApiLiveTest extends BaseComputeServiceContextLiveTest {
for (String region : view.unwrapApi(AWSEC2Api.class).getAvailabilityZoneAndRegionApi().get().describeRegions().keySet()) {
Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
assertNotNull(allResults);
assert allResults.size() >= 0 : allResults.size();
assert allResults.size() > 0 : allResults.size();
}
}
}

View File

@ -45,7 +45,7 @@ public class AccountApiLiveTest extends BaseSoftLayerApiLiveTest {
@Test
public void testListVirtualGuests() throws Exception {
Set<VirtualGuest> response = api().listVirtualGuests();
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (VirtualGuest vg : response) {
checkVirtualGuest(vg);
}

View File

@ -39,7 +39,7 @@ public class DatacenterApiLiveTest extends BaseSoftLayerApiLiveTest {
public void testListDatacenters() {
Set<Datacenter> response = api().listDatacenters();
assertNotNull(response);
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
for (Datacenter vg : response) {
Datacenter newDetails = api().getDatacenter(vg.getId());
assertEquals(vg.getId(), newDetails.getId());

View File

@ -33,7 +33,7 @@ public class SoftwareDescriptionApiLiveTest extends BaseSoftLayerApiLiveTest {
public void testGetAllObjects() {
Set<SoftwareDescription> response = api().getAllObjects();
assertNotNull(response);
assertTrue(response.size() >= 0);
assertTrue(response.size() > 0);
}
private SoftwareDescriptionApi api() {