/** * It is possible that the /extensions call returned the correct extension, but that the * namespaces were different, for whatever reason. One way to address this is to have a multimap * of the authoritative namespace to alternate ones, which could be wired up with guice */ public void testPresentWhenAliasForExtensionMapsToNamespace() throws SecurityException, NoSuchMethodException { Extension keypairsWithDifferentNamespace = keypairs .toBuilder() .namespace( URI.create("http://docs.openstack.org/ext/arbitrarilydifferent/keypairs/api/v1.1")) .build(); Multimap<URI, URI> aliases = ImmutableMultimap.of( keypairs.getNamespace(), keypairsWithDifferentNamespace.getNamespace()); assertEquals( whenExtensionsAndAliasesInRegionInclude( "region", ImmutableSet.of(keypairsWithDifferentNamespace), aliases) .apply(getKeyPairExtension(ImmutableList.<Object>of("region"))), Optional.of("foo")); assertEquals( whenExtensionsAndAliasesInRegionInclude( "region", ImmutableSet.of(keypairsWithDifferentNamespace), aliases) .apply(getFloatingIPExtension(ImmutableList.<Object>of("region"))), Optional.absent()); }