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 50c43570e4..01d4fcb82b 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 { } @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> regionToEndpoint = regionToEndpointSupplier.get(); checkState(regionToEndpoint.size() > 0, "no region name to endpoint mappings configured!"); checkArgument(regionToEndpoint.containsKey(from), 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 5f68741bfb..3c0aedc302 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.>> 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.>> ofInstance(ImmutableMap .> of())); fn.apply("1"); } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNullIsIllegal() { - RegionToEndpoint fn = new RegionToEndpoint(Suppliers.>> ofInstance(ImmutableMap.of("1", - Suppliers.ofInstance(URI.create("http://1"))))); - fn.apply(null); - } }