BaseType { public boolean isSameTypeAs(Object that) { if (equals(that)){ return true; } if (that instanceof String) { if (toString().equalsIgnoreCase((String)that)) { return true; } } return false; }  @Override boolean equals(Object that); @Override int hashCode(); boolean isSameTypeAs(Object that);  }
@Test public void testIsSameTypeAs() { Assert.assertTrue("'a' and 'A' should be considdered the same type", new TestType("a").isSameTypeAs("A")); Assert.assertTrue("'B' and 'b' should be considdered the same address", new TestType("B").isSameTypeAs(new TestType("b"))); }