### Question:
ServiceType implements Comparable<ServiceType> { public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; final ServiceType that = (ServiceType)obj; return type.equals(that.type); } ServiceType(String type); boolean isServiceURL(); boolean isAbstractType(); boolean isDefaultNamingAuthority(); String getConcreteTypeName(); String getPrincipleTypeName(); String getAbstractTypeName(); String getNamingAuthority(); boolean matches(ServiceType serviceType); int compareTo(ServiceType that); boolean equals(Object obj); int hashCode(); String asString(); @Override String toString(); static final String ANY_NAMING_AUTHORITY; static final String DEFAULT_NAMING_AUTHORITY; }### Answer:
@Test public void testEquals() throws Exception { ServiceType serviceType1 = new ServiceType("service:jmx:rmi"); ServiceType serviceType2 = new ServiceType("jmx:rmi"); assert !serviceType1.equals(serviceType2); serviceType2 = new ServiceType("service:jmx:rmi"); assert serviceType1.equals(serviceType2); }