diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-10 14:44:16 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-10 15:06:09 +0200 |
commit | e0f58988817a64aa549e36bff2b4c89f191e20ee (patch) | |
tree | 3273e6f23866911ee8e2492b06fd02b9db6ca7c0 /hosted-zone-api/src/test | |
parent | 3d1b445b10f70771cf7a4bce1ba2d285c553f930 (diff) |
Move Zone API to separate bundle
Diffstat (limited to 'hosted-zone-api/src/test')
-rw-r--r-- | hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java new file mode 100644 index 00000000000..6bc8b395e00 --- /dev/null +++ b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java @@ -0,0 +1,49 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.cloud; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * @author bratseth + */ +public class SystemInfoTest { + + @Test + public void testSystemInfo() { + Zone zone = new Zone(Environment.dev, "us-west-1"); + SystemInfo info = new SystemInfo(zone); + assertEquals(zone, info.zone()); + } + + @Test + public void testZone() { + Zone zone = Zone.from("dev.us-west-1"); + zone = Zone.from(zone.toString()); + assertEquals(Environment.dev, zone.environment()); + assertEquals("us-west-1", zone.region()); + Zone sameZone = Zone.from("dev.us-west-1"); + assertEquals(sameZone.hashCode(), zone.hashCode()); + assertEquals(sameZone, zone); + + try { + Zone.from("invalid"); + fail("Expected exception"); + } + catch (IllegalArgumentException e) { + assertEquals("A zone string must be on the form [environment].[region], but was 'invalid'", + e.getMessage()); + } + + try { + Zone.from("invalid.us-west-1"); + fail("Expected exception"); + } + catch (IllegalArgumentException e) { + assertEquals("Invalid zone 'invalid.us-west-1': No environment named 'invalid'", e.getMessage()); + } + } + +} |