From 6ab744d674f0ac00495df99b489a5414065216ea Mon Sep 17 00:00:00 2001 From: adriancole Date: Sun, 24 Mar 2013 22:05:52 -0700 Subject: [PATCH] addressed nits from issue #1453 --- .../ultradns/ws/domain/PoolRecordSpec.java | 12 +++---- .../ultradns/ws/domain/ResourceRecord.java | 4 +-- .../domain/TrafficControllerPoolRecord.java | 4 +-- .../ultradns/ws/domain/UpdatePoolRecord.java | 8 ++--- .../org/jclouds/ultradns/ws/domain/Zone.java | 2 +- .../ultradns/ws/domain/ZoneProperties.java | 2 +- .../ws/features/ResourceRecordAsyncApi.java | 4 +-- .../ws/features/RoundRobinPoolAsyncApi.java | 10 +++--- .../jclouds/ultradns/ws/features/TaskApi.java | 2 -- .../ultradns/ws/features/TaskAsyncApi.java | 4 +-- .../ws/features/TrafficControllerPoolApi.java | 2 -- .../TrafficControllerPoolAsyncApi.java | 8 ++--- .../jclouds/ultradns/ws/features/ZoneApi.java | 2 -- .../TrafficControllerPoolPredicates.java | 34 ++++--------------- .../ws/predicates/ZonePredicates.java | 33 ++++++++++-------- .../ultradns/ws/xml/AttributeHandler.java | 8 ++--- ...xtHandler.java => ElementTextHandler.java} | 20 +++++------ .../ultradns/ws/UltraDNSWSApiLiveTest.java | 6 ++-- .../features/ResourceRecordApiLiveTest.java | 29 ++++++++-------- .../features/RoundRobinPoolApiLiveTest.java | 10 +++--- .../ultradns/ws/features/TaskApiLiveTest.java | 10 +++--- .../TrafficControllerPoolApiLiveTest.java | 26 +++++++------- .../ultradns/ws/features/ZoneApiLiveTest.java | 29 ++++++++-------- .../ws/parse/RunTestResponseTest.java | 4 +-- .../TrafficControllerPoolPredicatesTest.java | 10 +++--- .../ws/predicates/ZonePredicatesTest.java | 8 +++-- 26 files changed, 130 insertions(+), 161 deletions(-) rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/{TextHandler.java => ElementTextHandler.java} (78%) diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java index f9d3b8a385..02f14d608c 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/PoolRecordSpec.java @@ -47,13 +47,13 @@ public final class PoolRecordSpec { this.probingEnabled = probingEnabled; this.allFailEnabled = allFailEnabled; this.weight = weight; - checkArgument(weight >= 0, "weight of %s must be unsigned", description); + checkArgument(weight >= 0, "weight of %s must be >= 0", description); this.failOverDelay = failOverDelay; - checkArgument(failOverDelay >= 0, "failOverDelay of %s must be unsigned", description); + checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", description); this.threshold = threshold; - checkArgument(threshold >= 0, "threshold of %s must be unsigned", description); + checkArgument(threshold >= 0, "threshold of %s must be >= 0", description); this.ttl = ttl; - checkArgument(ttl >= 0, "ttl of %s must be unsigned", description); + checkArgument(ttl >= 0, "ttl of %s must be >= 0", description); } /** @@ -114,8 +114,8 @@ public final class PoolRecordSpec { @Override public int hashCode() { - return Objects - .hashCode(description, state, probingEnabled, allFailEnabled, weight, failOverDelay, threshold, ttl); + return Objects.hashCode(description, state, probingEnabled, allFailEnabled, weight, failOverDelay, threshold, + ttl); } @Override diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java index ea4d97c3f8..2689eb75a1 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ResourceRecord.java @@ -42,9 +42,9 @@ public class ResourceRecord { private ResourceRecord(String dName, int type, int ttl, List infoValues) { this.dName = checkNotNull(dName, "dName"); - checkArgument(type >= 0, "type of %s must be unsigned", dName); + checkArgument(type >= 0, "type of %s must be >= 0", dName); this.type = type; - checkArgument(ttl >= 0, "ttl of %s must be unsigned", dName); + checkArgument(ttl >= 0, "ttl of %s must be >= 0", dName); this.ttl = ttl; this.infoValues = checkNotNull(infoValues, "infoValues of %s", dName); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java index 061aaf6ab7..1a05fced1d 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/TrafficControllerPoolRecord.java @@ -46,9 +46,9 @@ public final class TrafficControllerPoolRecord { this.id = checkNotNull(id, "id"); this.poolId = checkNotNull(poolId, "poolId for %s", id); this.pointsTo = checkNotNull(pointsTo, "pointsTo for %s", poolId); - checkArgument(weight >= 0, "weight of %s must be unsigned", id); + checkArgument(weight >= 0, "weight of %s must be >= 0", id); this.weight = weight; - checkArgument(priority >= 0, "priority of %s must be unsigned", id); + checkArgument(priority >= 0, "priority of %s must be >= 0", id); this.priority = priority; this.type = checkNotNull(type, "type for %s", poolId); this.forceAnswer = checkNotNull(forceAnswer, "forceAnswer for %s", poolId); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java index a7883b4e30..b8117cd9be 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/UpdatePoolRecord.java @@ -54,13 +54,13 @@ public final class UpdatePoolRecord { this.mode = checkNotNull(mode, "mode for %s", pointsTo); this.priority = priority; this.weight = weight; - checkArgument(weight >= 0, "weight of %s must be unsigned", pointsTo); + checkArgument(weight >= 0, "weight of %s must be >= 0", pointsTo); this.failOverDelay = failOverDelay; - checkArgument(failOverDelay >= 0, "failOverDelay of %s must be unsigned", pointsTo); + checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", pointsTo); this.threshold = threshold; - checkArgument(threshold >= 0, "threshold of %s must be unsigned", pointsTo); + checkArgument(threshold >= 0, "threshold of %s must be >= 0", pointsTo); this.ttl = ttl; - checkArgument(ttl >= 0, "ttl of %s must be unsigned", pointsTo); + checkArgument(ttl >= 0, "ttl of %s must be >= 0", pointsTo); } /** diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java index 45b6e83686..60370f6625 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Zone.java @@ -43,7 +43,7 @@ public final class Zone { DNSSECStatus dnssecStatus, Optional primarySrc) { this.id = checkNotNull(id, "id"); this.name = checkNotNull(name, "name for %s", id); - checkArgument(typeCode >= 0, "typeCode of %s must be unsigned", id); + checkArgument(typeCode >= 0, "typeCode of %s must be >= 0", id); this.typeCode = typeCode; this.type = checkNotNull(type, "type for %s", name); this.accountId = checkNotNull(accountId, "accountId for %s", name); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java index 014a7f801b..e2cd0472d4 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/ZoneProperties.java @@ -41,7 +41,7 @@ public final class ZoneProperties { private ZoneProperties(String name, Type type, int typeCode, Date modified, int resourceRecordCount) { this.name = checkNotNull(name, "name"); - checkArgument(typeCode >= 0, "typeCode of %s must be unsigned", name); + checkArgument(typeCode >= 0, "typeCode of %s must be >= 0", name); this.typeCode = typeCode; this.type = checkNotNull(type, "type for %s", name); this.modified = checkNotNull(modified, "modified for %s", name); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java index d8fab3688e..bf720f96ba 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java @@ -35,7 +35,7 @@ import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML; import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.TextHandler; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import com.google.common.collect.FluentIterable; @@ -56,7 +56,7 @@ public interface ResourceRecordAsyncApi { */ @Named("createResourceRecord") @POST - @XMLResponseParser(TextHandler.Guid.class) + @XMLResponseParser(ElementTextHandler.Guid.class) @MapBinder(ZoneAndResourceRecordToXML.class) ListenableFuture create(@PayloadParam("resourceRecord") ResourceRecord toCreate) throws ResourceAlreadyExistsException; diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java index ab27999f81..c1981c4306 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java @@ -33,7 +33,7 @@ import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsExcepti import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.RoundRobinPool; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.TextHandler; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler; @@ -74,7 +74,7 @@ public interface RoundRobinPoolAsyncApi { */ @Named("addRRLBPool") @POST - @XMLResponseParser(TextHandler.RRPoolID.class) + @XMLResponseParser(ElementTextHandler.RRPoolID.class) @Payload("{zoneName}{hostName}{description}1") ListenableFuture createAPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; @@ -84,7 +84,7 @@ public interface RoundRobinPoolAsyncApi { */ @Named("addRecordToRRPool") @POST - @XMLResponseParser(TextHandler.Guid.class) + @XMLResponseParser(ElementTextHandler.Guid.class) @Payload("") ListenableFuture addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl) @@ -114,7 +114,7 @@ public interface RoundRobinPoolAsyncApi { */ @Named("addRRLBPool") @POST - @XMLResponseParser(TextHandler.RRPoolID.class) + @XMLResponseParser(ElementTextHandler.RRPoolID.class) @Payload("{zoneName}{hostName}{description}28") ListenableFuture createAAAAPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; @@ -124,7 +124,7 @@ public interface RoundRobinPoolAsyncApi { */ @Named("addRecordToRRPool") @POST - @XMLResponseParser(TextHandler.Guid.class) + @XMLResponseParser(ElementTextHandler.Guid.class) @Payload("") ListenableFuture addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, @PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl) diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java index 5e35e6a03c..910718818f 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java @@ -36,8 +36,6 @@ public interface TaskApi { String runTest(String value); /** - * Retrieves information about the specified task - * * @param guid * guid of the task to get information about. * @return null if not found diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java index 919c37e472..6b35392fe1 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java @@ -31,7 +31,7 @@ import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.domain.Task; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.TextHandler; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.TaskHandler; import org.jclouds.ultradns.ws.xml.TaskListHandler; @@ -52,7 +52,7 @@ public interface TaskAsyncApi { */ @Named("runTest") @POST - @XMLResponseParser(TextHandler.Guid.class) + @XMLResponseParser(ElementTextHandler.Guid.class) @Payload("{value}") ListenableFuture runTest(@PayloadParam("value") String value); diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java index 4ad9b5eb08..dbca7f0627 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java @@ -118,8 +118,6 @@ public interface TrafficControllerPoolApi { throws ResourceAlreadyExistsException; /** - * Retrieves information about the specified pool record - * * @param poolRecordID * {@link TrafficControllerPoolRecord#getId()} * @return null if not found diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java index 75e1f39c6a..9c9a4a61ad 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java @@ -40,7 +40,7 @@ import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.xml.AttributeHandler; import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler; -import org.jclouds.ultradns.ws.xml.TextHandler; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler; import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler; @@ -62,7 +62,7 @@ public interface TrafficControllerPoolAsyncApi { */ @Named("addTCLBPool") @POST - @XMLResponseParser(TextHandler.TCPoolID.class) + @XMLResponseParser(ElementTextHandler.TCPoolID.class) @Payload("{zoneName}{hostName}{description}1EnabledEnabled0") ListenableFuture createPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; @@ -110,7 +110,7 @@ public interface TrafficControllerPoolAsyncApi { */ @Named("addPoolRecord") @POST - @XMLResponseParser(TextHandler.PoolRecordID.class) + @XMLResponseParser(ElementTextHandler.PoolRecordID.class) @Payload("{poolID}{pointsTo}{ttl}") ListenableFuture addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo, @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; @@ -120,7 +120,7 @@ public interface TrafficControllerPoolAsyncApi { */ @Named("addPoolRecord") @POST - @XMLResponseParser(TextHandler.PoolRecordID.class) + @XMLResponseParser(ElementTextHandler.PoolRecordID.class) @Payload("{poolID}{pointsTo}{ttl}{weight}") ListenableFuture addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String pointsTo, @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight) diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java index ad631f6cd4..f2f9b36291 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java @@ -45,8 +45,6 @@ public interface ZoneApi { void createInAccount(String name, String accountId) throws ResourceAlreadyExistsException; /** - * Retrieves information about the specified zone - * * @param name * the fully-qualified name, including the trailing dot, of the * zone to get information about. diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java index 89067ab839..3a358beab0 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicates.java @@ -32,15 +32,6 @@ import com.google.common.base.Predicate; */ public class TrafficControllerPoolPredicates { - /** - * evaluates to true if the input {@link TrafficControllerPool} exists - * with {@link TrafficControllerPool#getId() id} corresponding to the - * {@code id} parameter. - * - * @param id - * the {@link TrafficControllerPool#getId() id} of the - * desired pool record - */ public static Predicate idEqualTo(String id) { return new IdEqualToPredicate(id); } @@ -54,9 +45,7 @@ public class TrafficControllerPoolPredicates { @Override public boolean apply(TrafficControllerPool input) { - if (input == null) - return false; - return id.equals(input.getId()); + return input != null && id.equals(input.getId()); } @Override @@ -65,36 +54,25 @@ public class TrafficControllerPoolPredicates { } } - /** - * evaluates to true if the input {@link TrafficControllerPoolRecord} exists - * with {@link TrafficControllerPoolRecord#getId() id} corresponding to the - * {@code recordId} parameter. - * - * @param recordId - * the {@link TrafficControllerPoolRecord#getId() id} of the - * desired pool record - */ public static Predicate recordIdEqualTo(String recordId) { return new RecordIdEqualToPredicate(recordId); } private static final class RecordIdEqualToPredicate implements Predicate { - private final String id; + private final String recordId; - public RecordIdEqualToPredicate(String id) { - this.id = checkNotNull(id, "recordId"); + public RecordIdEqualToPredicate(String recordId) { + this.recordId = checkNotNull(recordId, "recordId"); } @Override public boolean apply(TrafficControllerPoolRecord input) { - if (input == null) - return false; - return id.equals(input.getId()); + return input != null && recordId.equals(input.getId()); } @Override public String toString() { - return "RecordIdEqualTo(" + id + ")"; + return "RecordIdEqualTo(" + recordId + ")"; } } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/ZonePredicates.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/ZonePredicates.java index 72e6b84b31..21d8a68433 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/ZonePredicates.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/predicates/ZonePredicates.java @@ -32,22 +32,25 @@ import com.google.common.base.Predicate; */ public class ZonePredicates { - /** - * matches zones of the given type - */ - public static Predicate typeEquals(final Type type) { - checkNotNull(type, "type must be defined"); + public static Predicate typeEqualTo(Type type) { + return new TypeEqualToPredicate(type); + } - return new Predicate() { - @Override - public boolean apply(Zone zone) { - return type.equals(zone.getType()); - } + private static final class TypeEqualToPredicate implements Predicate { + private final Type type; - @Override - public String toString() { - return "typeEquals(" + type + ")"; - } - }; + public TypeEqualToPredicate(Type type) { + this.type = checkNotNull(type, "type"); + } + + @Override + public boolean apply(Zone input) { + return input != null && type.equals(input.getType()); + } + + @Override + public String toString() { + return "TypeEqualTo(" + type + ")"; + } } } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AttributeHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AttributeHandler.java index 5dc9b32d86..117364562d 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AttributeHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AttributeHandler.java @@ -37,7 +37,7 @@ public abstract class AttributeHandler extends ParseSax.HandlerForGeneratedReque } } - private String attributeName; + private final String attributeName; private String attribute = null; private AttributeHandler(String attributeName) { @@ -46,11 +46,7 @@ public abstract class AttributeHandler extends ParseSax.HandlerForGeneratedReque @Override public String getResult() { - try { - return checkNotNull(attribute, "%s not present in the response", attributeName); - } finally { - attribute = null; - } + return checkNotNull(attribute, "%s not present in the response", attributeName); } @Override diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TextHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ElementTextHandler.java similarity index 78% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TextHandler.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ElementTextHandler.java index ce59512213..3fa4fa939d 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/TextHandler.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/ElementTextHandler.java @@ -28,48 +28,44 @@ import org.jclouds.http.functions.ParseSax; * * @author Adrian Cole */ -public abstract class TextHandler extends ParseSax.HandlerForGeneratedRequestWithResult { +public abstract class ElementTextHandler extends ParseSax.HandlerForGeneratedRequestWithResult { - public static class Guid extends TextHandler { + public static class Guid extends ElementTextHandler { public Guid() { super("guid"); } } - public static class RRPoolID extends TextHandler { + public static class RRPoolID extends ElementTextHandler { public RRPoolID() { super("RRPoolID"); } } - public static class TCPoolID extends TextHandler { + public static class TCPoolID extends ElementTextHandler { public TCPoolID() { super("TCPoolID"); } } - public static class PoolRecordID extends TextHandler { + public static class PoolRecordID extends ElementTextHandler { public PoolRecordID() { super("poolRecordID"); } } - private String textElement; + private final String textElement; private StringBuilder currentText = new StringBuilder(); private String text = null; - private TextHandler(String textElement) { + private ElementTextHandler(String textElement) { this.textElement = checkNotNull(textElement, "textElement"); } @Override public String getResult() { - try { - return checkNotNull(text, "%s not present in the response", textElement); - } finally { - text = null; - } + return checkNotNull(text, "%s not present in the response", textElement); } @Override diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java index dbce57f4cb..9225c689c5 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/UltraDNSWSApiLiveTest.java @@ -18,7 +18,7 @@ */ package org.jclouds.ultradns.ws; -import static com.google.common.base.Preconditions.checkNotNull; +import static org.testng.Assert.assertNotNull; import org.jclouds.ultradns.ws.domain.Account; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; @@ -37,8 +37,8 @@ public class UltraDNSWSApiLiveTest extends BaseUltraDNSWSApiLiveTest { } private void checkAccount(Account account) { - checkNotNull(account.getId(), "Id cannot be null for an Account."); - checkNotNull(account.getName(), "Name cannot be null for Account %s", account); + assertNotNull(account.getId(), "Id cannot be null for " + account); + assertNotNull(account.getName(), "Name cannot be null for " + account); } protected UltraDNSWSApi api() { diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java index 18920a2d63..1c9acd09af 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ResourceRecordApiLiveTest.java @@ -17,12 +17,12 @@ * under the License. */ package org.jclouds.ultradns.ws.features; - -import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.equalTo; +import static java.lang.String.format; import static java.util.logging.Logger.getAnonymousLogger; import static org.jclouds.ultradns.ws.domain.ResourceRecord.rrBuilder; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -72,20 +72,20 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { } static void checkResourceRecord(ResourceRecord rr) { - checkNotNull(rr.getName(), "DName cannot be null for a ResourceRecord %s", rr); - checkNotNull(rr.getType(), "Type cannot be null for a ResourceRecord %s", rr); - assertTrue(rr.getType() > 0, "Type must be unsigned for a ResourceRecord " + rr); - checkNotNull(rr.getType(), "Type cannot be null for a ResourceRecord %s", rr); - checkNotNull(rr.getTTL(), "TTL cannot be null for a ResourceRecord %s", rr); - checkNotNull(rr.getRData(), "InfoValues cannot be null for a ResourceRecord %s", rr); + assertNotNull(rr.getName(), "DName cannot be null for " + rr); + assertNotNull(rr.getType(), "Type cannot be null for " + rr); + assertTrue(rr.getType() > 0, "Type must be unsigned for " + rr); + assertNotNull(rr.getType(), "Type cannot be null for " + rr); + assertNotNull(rr.getTTL(), "TTL cannot be null for " + rr); + assertNotNull(rr.getRData(), "InfoValues cannot be null for " + rr); } static void checkResourceRecordMetadata(ResourceRecordMetadata rr) { - checkNotNull(rr.getZoneId(), "ZoneId cannot be null for a ResourceRecordMetadata %s", rr); - checkNotNull(rr.getGuid(), "Guid cannot be null for a ResourceRecordMetadata %s", rr); - checkNotNull(rr.getZoneName(), "ZoneName cannot be null for a ResourceRecordMetadata %s", rr); - checkNotNull(rr.getCreated(), "Created cannot be null for a ResourceRecordMetadata %s", rr); - checkNotNull(rr.getModified(), "Modified cannot be null for a ResourceRecordMetadata %s", rr); + assertNotNull(rr.getZoneId(), "ZoneId cannot be null for " + rr); + assertNotNull(rr.getGuid(), "Guid cannot be null for " + rr); + assertNotNull(rr.getZoneName(), "ZoneName cannot be null for " + rr); + assertNotNull(rr.getCreated(), "Created cannot be null for " + rr); + assertNotNull(rr.getModified(), "Modified cannot be null for " + rr); checkResourceRecord(rr.getRecord()); } @@ -113,8 +113,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest { void logSummary() { getAnonymousLogger().info("zoneCount: " + zones); for (Entry entry : recordTypeCounts.asMap().entrySet()) - getAnonymousLogger().info( - String.format("type: %s, count: %s", entry.getKey(), entry.getValue())); + getAnonymousLogger().info(format("type: %s, count: %s", entry.getKey(), entry.getValue())); } @Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Zone does not exist in the system.") diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java index 651b86aff3..dceb28470b 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApiLiveTest.java @@ -18,12 +18,12 @@ */ package org.jclouds.ultradns.ws.features; -import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.equalTo; import static java.util.logging.Logger.getAnonymousLogger; import static org.jclouds.ultradns.ws.domain.ResourceRecord.rrBuilder; 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 static org.testng.Assert.fail; @@ -62,10 +62,10 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest { } private void checkRRPool(RoundRobinPool pool) { - checkNotNull(pool.getZoneId(), "ZoneId cannot be null for a RoundRobinPool %s", pool); - checkNotNull(pool.getId(), "Id cannot be null for a RoundRobinPool %s", pool); - checkNotNull(pool.getName(), "Name cannot be null for a RoundRobinPool %s", pool); - checkNotNull(pool.getDName(), "DName cannot be null for a RoundRobinPool %s", pool); + assertNotNull(pool.getZoneId(), "ZoneId cannot be null for " + pool); + assertNotNull(pool.getId(), "Id cannot be null for " + pool); + assertNotNull(pool.getName(), "Name cannot be null for " + pool); + assertNotNull(pool.getDName(), "DName cannot be null for " + pool); } @Test diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java index 7cb28c7eb6..33da93c9d5 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TaskApiLiveTest.java @@ -18,8 +18,8 @@ */ package org.jclouds.ultradns.ws.features; -import static com.google.common.base.Preconditions.checkNotNull; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import org.jclouds.ultradns.ws.domain.Task; @@ -33,10 +33,10 @@ import org.testng.annotations.Test; public class TaskApiLiveTest extends BaseUltraDNSWSApiLiveTest { private void checkTask(Task task) { - checkNotNull(task.getGuid(), "Guid cannot be null for a Task %s", task); - checkNotNull(task.getStatusCode(), "StatusCode cannot be null for a Task %s", task); - checkNotNull(task.getMessage(), "While Message can be null for a Task, its Optional wrapper cannot %s", task); - checkNotNull(task.getResultUrl(), "While ResultUrl can be null for a Task, its Optional wrapper cannot %s", task); + assertNotNull(task.getGuid(), "Guid cannot be null for " + task); + assertNotNull(task.getStatusCode(), "StatusCode cannot be null for " + task); + assertNotNull(task.getMessage(), "While Message can be null, its Optional wrapper cannot " + task); + assertNotNull(task.getResultUrl(), "While ResultUrl can be null, its Optional wrapper cannot " + task); } @Test diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java index 4b5a613fbe..eebb0cb2b3 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApiLiveTest.java @@ -18,12 +18,12 @@ */ package org.jclouds.ultradns.ws.features; -import static com.google.common.base.Preconditions.checkNotNull; import static java.util.logging.Logger.getAnonymousLogger; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo; 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.assertTrue; import static org.testng.Assert.fail; @@ -65,10 +65,10 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest } private void checkTCPool(TrafficControllerPool pool) { - checkNotNull(pool.getZoneId(), "ZoneId cannot be null for %s", pool); - checkNotNull(pool.getId(), "Id cannot be null for %s", pool); - checkNotNull(pool.getName(), "Name cannot be null for %s", pool); - checkNotNull(pool.getDName(), "DName cannot be null for %s", pool); + assertNotNull(pool.getZoneId(), "ZoneId cannot be null " + pool); + assertNotNull(pool.getId(), "Id cannot be null " + pool); + assertNotNull(pool.getName(), "Name cannot be null " + pool); + assertNotNull(pool.getDName(), "DName cannot be null " + pool); assertEquals(api(zoneName).getNameByDName(pool.getDName()), pool.getName()); } @@ -104,21 +104,21 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest } static TrafficControllerPoolRecord checkTrafficControllerPoolRecord(TrafficControllerPoolRecord record) { - checkNotNull(record.getId(), "Id cannot be null for %s", record); - checkNotNull(record.getPoolId(), "PoolId cannot be null for %s", record); - checkNotNull(record.getPointsTo(), "PointsTo cannot be null for %s", record); + assertNotNull(record.getId(), "Id cannot be null for " + record); + assertNotNull(record.getPoolId(), "PoolId cannot be null for " + record); + assertNotNull(record.getPointsTo(), "PointsTo cannot be null for " + record); assertTrue(record.getWeight() >= 0, "Weight must be unsigned for " + record); assertTrue(record.getPriority() >= 0, "Priority must be unsigned for " + record); - checkNotNull(record.getType(), "Type cannot be null for %s", record); - checkNotNull(record.getStatus(), "Status cannot be null for %s", record); + assertNotNull(record.getType(), "Type cannot be null for " + record); + assertNotNull(record.getStatus(), "Status cannot be null for " + record); assertTrue(record.getStatus() != Status.UNRECOGNIZED, "unrecognized status for " + record); - checkNotNull(record.getDescription(), "Description cannot be null for %s", record); + assertNotNull(record.getDescription(), "Description cannot be null for " + record); return record; } static PoolRecordSpec checkPoolRecordSpec(PoolRecordSpec record) { - checkNotNull(record.getDescription(), "Description cannot be null for %s", record); - checkNotNull(record.getState(), "State cannot be null for %s", record); + assertNotNull(record.getDescription(), "Description cannot be null for " + record); + assertNotNull(record.getState(), "State cannot be null for " + record); // TODO: collect all possible states then consider enum assertTrue(ImmutableSet.of("Normal", "Normal-NoTest").contains(record.getState()), "Unknown State for " + record); assertTrue(record.getWeight() >= 0, "Weight must be unsigned for " + record); diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java index e30acf7c7a..cc07630995 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/features/ZoneApiLiveTest.java @@ -18,11 +18,11 @@ */ package org.jclouds.ultradns.ws.features; -import static com.google.common.base.Preconditions.checkNotNull; import static java.util.logging.Logger.getAnonymousLogger; import static org.jclouds.ultradns.ws.domain.Zone.Type.PRIMARY; -import static org.jclouds.ultradns.ws.predicates.ZonePredicates.typeEquals; +import static org.jclouds.ultradns.ws.predicates.ZonePredicates.typeEqualTo; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -55,17 +55,16 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest { } private void checkZone(Zone zone) { - checkNotNull(zone.getId(), "Id cannot be null for a Zone %s", zone); - checkNotNull(zone.getName(), "Name cannot be null for a Zone %s", zone); - checkNotNull(zone.getType(), "Type cannot be null for a Zone %s", zone); - checkNotNull(zone.getTypeCode(), "TypeCode cannot be null for a Zone %s", zone); + assertNotNull(zone.getId(), "Id cannot be null for " + zone); + assertNotNull(zone.getName(), "Name cannot be null for " + zone); + assertNotNull(zone.getType(), "Type cannot be null for " + zone); + assertNotNull(zone.getTypeCode(), "TypeCode cannot be null for " + zone); assertEquals(zone.getTypeCode(), zone.getType().getCode()); - checkNotNull(zone.getAccountId(), "AccountId cannot be null for a Zone %s", zone); + assertNotNull(zone.getAccountId(), "AccountId cannot be null for " + zone); assertEquals(zone.getAccountId(), account.getId()); - checkNotNull(zone.getOwnerId(), "OwnerId cannot be null for a Zone %s", zone); - checkNotNull(zone.getDNSSECStatus(), "DNSSECStatus cannot be null for a Zone %s", zone); - checkNotNull(zone.getPrimarySrc(), "While PrimarySrc can be null for a Zone, its Optional wrapper cannot %s", - zone); + assertNotNull(zone.getOwnerId(), "OwnerId cannot be null for " + zone); + assertNotNull(zone.getDNSSECStatus(), "DNSSECStatus cannot be null for " + zone); + assertNotNull(zone.getPrimarySrc(), "While PrimarySrc can be null, its Optional wrapper cannot " + zone); } @Test @@ -76,9 +75,9 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest { checkZone(zone); } - if (response.anyMatch(typeEquals(PRIMARY))) { + if (response.anyMatch(typeEqualTo(PRIMARY))) { assertEquals(api().listByAccountAndType(account.getId(), PRIMARY).toSet(), response - .filter(typeEquals(PRIMARY)).toSet()); + .filter(typeEqualTo(PRIMARY)).toSet()); } } @@ -94,7 +93,7 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest { assertEquals(zoneProperties.getName(), zone.getName()); assertEquals(zoneProperties.getType(), zone.getType()); assertEquals(zoneProperties.getTypeCode(), zone.getTypeCode()); - checkNotNull(zoneProperties.getModified(), "Modified cannot be null for a Zone %s", zone); + assertNotNull(zoneProperties.getModified(), "Modified cannot be null for " + zone); assertTrue(zoneProperties.getResourceRecordCount() >= 0, "ResourceRecordCount must be positive or zero for a Zone " + zone); } @@ -134,7 +133,7 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest { assertEquals(newZone.getName(), name); assertEquals(newZone.getType(), Type.PRIMARY); assertEquals(newZone.getTypeCode(), Type.PRIMARY.getCode()); - checkNotNull(newZone.getModified(), "Modified cannot be null for a Zone %s", newZone); + assertNotNull(newZone.getModified(), "Modified cannot be null for " + newZone); assertEquals(newZone.getResourceRecordCount(), 5); } finally { api().delete(name); diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/RunTestResponseTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/RunTestResponseTest.java index 70b6edbee0..28452378f3 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/RunTestResponseTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/parse/RunTestResponseTest.java @@ -23,7 +23,7 @@ import static org.testng.Assert.assertEquals; import java.io.InputStream; import org.jclouds.http.functions.BaseHandlerTest; -import org.jclouds.ultradns.ws.xml.TextHandler; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.testng.annotations.Test; /** @@ -35,7 +35,7 @@ public class RunTestResponseTest extends BaseHandlerTest { public void test() { InputStream is = getClass().getResourceAsStream("/taskid.xml"); - TextHandler.Guid handler = injector.getInstance(TextHandler.Guid.class); + ElementTextHandler.Guid handler = injector.getInstance(ElementTextHandler.Guid.class); assertEquals(factory.create(handler).parse(is), "8d7a1725-4f4a-4b70-affa-f01dcce1526e"); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java index 0ffadd663a..528ae26998 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/TrafficControllerPoolPredicatesTest.java @@ -20,6 +20,8 @@ package org.jclouds.ultradns.ws.predicates; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; @@ -43,12 +45,12 @@ public class TrafficControllerPoolPredicatesTest { @Test public void testIdEqualToWhenEqual() { - assert idEqualTo("000000000000002").apply(pool); + assertTrue(idEqualTo("000000000000002").apply(pool)); } @Test public void testIdEqualToWhenNotEqual() { - assert !idEqualTo("000000000000003").apply(pool); + assertFalse(idEqualTo("000000000000003").apply(pool)); } TrafficControllerPoolRecord record = TrafficControllerPoolRecord.builder() @@ -66,11 +68,11 @@ public class TrafficControllerPoolPredicatesTest { @Test public void testRecordIdEqualToWhenEqual() { - assert recordIdEqualTo("0000000000000001").apply(record); + assertTrue(recordIdEqualTo("0000000000000001").apply(record)); } @Test public void testRecordIdEqualToWhenNotEqual() { - assert !recordIdEqualTo("0000000000000002").apply(record); + assertFalse(recordIdEqualTo("0000000000000002").apply(record)); } } diff --git a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/ZonePredicatesTest.java b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/ZonePredicatesTest.java index 88d3883cba..1466044799 100644 --- a/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/ZonePredicatesTest.java +++ b/providers/ultradns-ws/src/test/java/org/jclouds/ultradns/ws/predicates/ZonePredicatesTest.java @@ -18,7 +18,9 @@ */ package org.jclouds.ultradns.ws.predicates; -import static org.jclouds.ultradns.ws.predicates.ZonePredicates.typeEquals; +import static org.jclouds.ultradns.ws.predicates.ZonePredicates.typeEqualTo; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone.DNSSECStatus; @@ -41,11 +43,11 @@ public class ZonePredicatesTest { @Test public void testTypeEqualsWhenEqual() { - assert typeEquals(Type.PRIMARY).apply(zone); + assertTrue(typeEqualTo(Type.PRIMARY).apply(zone)); } @Test public void testTypeEqualsWhenNotEqual() { - assert !typeEquals(Type.SECONDARY).apply(zone); + assertFalse(typeEqualTo(Type.SECONDARY).apply(zone)); } }