@Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else if (obj == null) {
            return false;
        } else if (obj instanceof NamespaceAndName) {
            NamespaceAndName nrn = (NamespaceAndName) obj;
            if ((nrn.getName() == null && name == null) ||
                    (nrn.getName().equals(name) && ((nrn.getNamespace() == null && namespace == null)
                            || nrn.getNamespace().equals(namespace)))) {
                return true;
            }
        }
        return false;
    }
@Test
    public void testEquals()   {
        NamespaceAndName original = new NamespaceAndName("namespace1", "name1");

        assertThat(original, is(new NamespaceAndName("namespace1", "name1")));
        assertThat(original, is(not(new NamespaceAndName("namespace2", "name1"))));
        assertThat(original, is(not(new NamespaceAndName("namespace1", "name2"))));
        assertThat(original, is(not(new NamespaceAndName("namespace2", "name2"))));
    }