You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/11/18 18:53:32 UTC

[13/17] jclouds git commit: Small cleanup of how RegionToEndpoint checks arguments.

Small cleanup of how RegionToEndpoint checks arguments.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/ca58491c
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/ca58491c
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/ca58491c

Branch: refs/heads/1.7.x
Commit: ca58491ce8e3c04cec59ede6fccfafc043ca449e
Parents: 8a322c4
Author: Zack Shoylev <za...@rackspace.com>
Authored: Wed Nov 12 08:36:50 2014 -0600
Committer: Adrian Cole <ad...@apache.org>
Committed: Tue Nov 18 09:40:37 2014 -0800

----------------------------------------------------------------------
 .../jclouds/location/functions/RegionToEndpoint.java |  4 +---
 .../location/functions/RegionToEndpointTest.java     | 15 ---------------
 2 files changed, 1 insertion(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/ca58491c/core/src/main/java/org/jclouds/location/functions/RegionToEndpoint.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/location/functions/RegionToEndpoint.java b/core/src/main/java/org/jclouds/location/functions/RegionToEndpoint.java
index d60fb6b..292c70d 100644
--- a/core/src/main/java/org/jclouds/location/functions/RegionToEndpoint.java
+++ b/core/src/main/java/org/jclouds/location/functions/RegionToEndpoint.java
@@ -26,7 +26,6 @@ import java.util.Map;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 
-import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.location.Region;
 
 import com.google.common.base.Function;
@@ -47,8 +46,7 @@ public class RegionToEndpoint implements Function<Object, URI> {
    }
 
    @Override
-   public URI apply(@Nullable Object from) {
-      checkArgument(from != null && from instanceof String, "you must specify a region, as a String argument");
+   public URI apply(Object from) {
       Map<String, Supplier<URI>> regionToEndpoint = regionToEndpointSupplier.get();
       checkState(regionToEndpoint.size() > 0, "no region name to endpoint mappings configured!");
       checkArgument(regionToEndpoint.containsKey(from),

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ca58491c/core/src/test/java/org/jclouds/location/functions/RegionToEndpointTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/location/functions/RegionToEndpointTest.java b/core/src/test/java/org/jclouds/location/functions/RegionToEndpointTest.java
index 68ef5cb..4739ea2 100644
--- a/core/src/test/java/org/jclouds/location/functions/RegionToEndpointTest.java
+++ b/core/src/test/java/org/jclouds/location/functions/RegionToEndpointTest.java
@@ -18,7 +18,6 @@ package org.jclouds.location.functions;
 
 import static org.testng.Assert.assertEquals;
 
-import java.io.File;
 import java.net.URI;
 import java.util.Map;
 
@@ -43,24 +42,10 @@ public class RegionToEndpointTest {
       assertEquals(fn.apply("1"), URI.create("http://1"));
    }
 
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testMustBeString() {
-      RegionToEndpoint fn = new RegionToEndpoint(Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap.of("1",
-               Suppliers.ofInstance(URI.create("http://1")))));
-      fn.apply(new File("foo"));
-   }
-
    @Test(expectedExceptions = IllegalStateException.class)
    public void testMustHaveEndpoints() {
       RegionToEndpoint fn = new RegionToEndpoint(Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap
                .<String, Supplier<URI>> of()));
       fn.apply("1");
    }
-
-   @Test(expectedExceptions = IllegalArgumentException.class)
-   public void testNullIsIllegal() {
-      RegionToEndpoint fn = new RegionToEndpoint(Suppliers.<Map<String, Supplier<URI>>> ofInstance(ImmutableMap.of("1",
-               Suppliers.ofInstance(URI.create("http://1")))));
-      fn.apply(null);
-   }
 }