@Test void getRegion_availabilityZoneWithMatchingRegion_returnsRegion() throws Exception { Ec2MetadataRegionProvider regionProvider = new Ec2MetadataRegionProvider() { @Override protected Region getCurrentRegion() { return Region.getRegion(Regions.EU_WEST_1); } }; Region region = regionProvider.getRegion(); assertThat(region).isEqualTo(Region.getRegion(Regions.EU_WEST_1)); }
@Override public Region getRegion() { Region currentRegion = getCurrentRegion(); Assert.state(currentRegion != null, "There is no EC2 meta data available, because the application is not running " + "in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance"); return currentRegion; }
Ec2MetadataRegionProvider implements RegionProvider { @Override public Region getRegion() { Region currentRegion = getCurrentRegion(); Assert.state(currentRegion != null, "There is no EC2 meta data available, because the application is not running " + "in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance"); return currentRegion; } }
Ec2MetadataRegionProvider implements RegionProvider { @Override public Region getRegion() { Region currentRegion = getCurrentRegion(); Assert.state(currentRegion != null, "There is no EC2 meta data available, because the application is not running " + "in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance"); return currentRegion; }  }
Ec2MetadataRegionProvider implements RegionProvider { @Override public Region getRegion() { Region currentRegion = getCurrentRegion(); Assert.state(currentRegion != null, "There is no EC2 meta data available, because the application is not running " + "in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance"); return currentRegion; }  @Override Region getRegion(); }
Ec2MetadataRegionProvider implements RegionProvider { @Override public Region getRegion() { Region currentRegion = getCurrentRegion(); Assert.state(currentRegion != null, "There is no EC2 meta data available, because the application is not running " + "in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance"); return currentRegion; }  @Override Region getRegion();  }