ServiceCoordinate { @Override public boolean equals(final Object otherInstance) { if (this == otherInstance) { return true; } if (otherInstance == null || getClass() != otherInstance.getClass()) { return false; } final ServiceCoordinate other = (ServiceCoordinate) otherInstance; if (!this.region.equals(other.region) || !this.tag.equals(other.tag) || !this.service.equals(other.service)) { return false; } return true; } ServiceCoordinate(final CloudnamePath path); String getRegion(); String getTag(); String getService(); static ServiceCoordinate parse(final String serviceCoordinateString); @Override boolean equals(final Object otherInstance); @Override int hashCode();  }
@Test public void testEquals() { final ServiceCoordinate coordA = ServiceCoordinate.parse("a.b.c"); final ServiceCoordinate coordB = ServiceCoordinate.parse("a.b.c"); final ServiceCoordinate coordC = ServiceCoordinate.parse("a.b.d"); final ServiceCoordinate coordD = ServiceCoordinate.parse("a.a.c"); final ServiceCoordinate coordE = ServiceCoordinate.parse("a.a.a"); final ServiceCoordinate coordF = ServiceCoordinate.parse("c.b.c"); assertThat(coordA, is(equalTo(coordB))); assertThat(coordB, is(equalTo(coordA))); assertThat(coordA, is(not(equalTo(coordC)))); assertThat(coordA, is(not(equalTo(coordD)))); assertThat(coordA, is(not(equalTo(coordE)))); assertThat(coordA, is(not(equalTo(coordF)))); assertThat(coordA.equals(null), is(false)); assertThat(coordA.equals(new Object()), is(false)); }