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

jclouds git commit: Small cleanup of how RegionToEndpoint checks arguments.

Repository: jclouds
Updated Branches:
  refs/heads/master 55be9b855 -> 91f405c9f


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/91f405c9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/91f405c9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/91f405c9

Branch: refs/heads/master
Commit: 91f405c9fedf24822015172e9e3c50acbd855d28
Parents: 55be9b8
Author: Zack Shoylev <za...@rackspace.com>
Authored: Wed Nov 12 08:36:50 2014 -0600
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Thu Nov 13 04:37:07 2014 -0600

----------------------------------------------------------------------
 .../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/91f405c9/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 ac1edf1..e4bcd31 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;
@@ -43,8 +42,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.isEmpty(), "no region name to endpoint mappings configured!");
       checkArgument(regionToEndpoint.containsKey(from),

http://git-wip-us.apache.org/repos/asf/jclouds/blob/91f405c9/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 5f68741..3c0aedc 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;
 
@@ -41,24 +40,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);
-   }
 }