### Question:
RegionMetadata { @Deprecated public Region getRegionByEndpoint(final String endpoint) { return provider.getRegionByEndpoint(endpoint); } RegionMetadata(final List<Region> regions);  RegionMetadata(RegionMetadataProvider provider); List<Region> getRegions(); Region getRegion(final String name); List<Region> getRegionsForService(final String service); @Deprecated Region getRegionByEndpoint(final String endpoint); @Override String toString();  }### Answer:
@Test public void testGetRegionByEndpoint() { Region region = metadata.getRegionByEndpoint("s3-us-west-1.amazonaws.com"); Assert.assertNotNull(region); Assert.assertEquals("us-west-1", region.getName()); try { metadata.getRegionByEndpoint("bogus-monkeys"); Assert.fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
@SuppressWarnings("deprecation") @Test public void testGetRegionByEndpoint() { Region region = metadata.getRegionByEndpoint("kec.cn-beijing-6.api.ksyun.com"); Assert.assertNotNull(region); Assert.assertEquals("cn-beijing-6", region.getName()); try { metadata.getRegionByEndpoint("bogus-monkeys"); Assert.fail("Expected an IllegalArgumentException"); } catch (IllegalArgumentException e) { } }