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 d60fb6b039..292c70d373 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 { } @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 68ef5cba3e..4739ea2b66 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.>> 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); - } }