InstanceCoordinate { public static InstanceCoordinate parse(final String string) { if (string == null) { return null; } final Matcher matcher = COORDINATE_PATTERN.matcher(string); if (!matcher.matches()) { return null; } final String[] path = new String[] { matcher.group(4), matcher.group(3), matcher.group(2), matcher.group(1) }; return new InstanceCoordinate(new CloudnamePath(path)); } InstanceCoordinate(final CloudnamePath path); String getRegion(); String getTag(); String getService(); String getInstance(); String toCanonicalString(); static InstanceCoordinate parse(final String string); @Override String toString();  }
@Test public void invalidStringConversion() { assertThat(InstanceCoordinate.parse("foo:bar.baz"), is(nullValue())); assertThat(InstanceCoordinate.parse(null), is(nullValue())); assertThat(InstanceCoordinate.parse("foo.bar.baz"), is(nullValue())); assertThat(InstanceCoordinate.parse(""), is(nullValue())); }
@Test (expected = IllegalArgumentException.class) public void invalidNames2() { assertThat(InstanceCoordinate.parse("æ.ø.å.a"), is(nullValue())); }