@Test public void testEqualsObject() { uri = new PageURIImpl(site, path); location = new PageletURIImpl(uri, composer, position); PageletURI sameLocation = new PageletURIImpl(uri, composer, position); assertEquals(location, sameLocation); assertFalse(location.equals(new PageletURIImpl(new PageURIImpl(site, "/test2"), composer, position))); assertFalse(location.equals(new PageletURIImpl(uri, "main2", position))); assertFalse(location.equals(new PageletURIImpl(uri, composer, position + 1))); }
@Override public boolean equals(Object o) { if (o instanceof PageletURI) { PageletURI l = (PageletURI) o; if (l.getPageURI() != null && l.getComposer() != null) return l.getPageURI().equals(pageURI) && l.getComposer().equals(composer) && l.getPosition() == position; } return false; }
PageletURIImpl implements PageletURI { @Override public boolean equals(Object o) { if (o instanceof PageletURI) { PageletURI l = (PageletURI) o; if (l.getPageURI() != null && l.getComposer() != null) return l.getPageURI().equals(pageURI) && l.getComposer().equals(composer) && l.getPosition() == position; } return false; } }
PageletURIImpl implements PageletURI { @Override public boolean equals(Object o) { if (o instanceof PageletURI) { PageletURI l = (PageletURI) o; if (l.getPageURI() != null && l.getComposer() != null) return l.getPageURI().equals(pageURI) && l.getComposer().equals(composer) && l.getPosition() == position; } return false; } PageletURIImpl(ResourceURI pageURI, String composer, int position); }
PageletURIImpl implements PageletURI { @Override public boolean equals(Object o) { if (o instanceof PageletURI) { PageletURI l = (PageletURI) o; if (l.getPageURI() != null && l.getComposer() != null) return l.getPageURI().equals(pageURI) && l.getComposer().equals(composer) && l.getPosition() == position; } return false; } PageletURIImpl(ResourceURI pageURI, String composer, int position); Site getSite(); ResourceURI getPageURI(); String getComposer(); int getPosition(); void setURI(ResourceURI uri); void setComposer(String composer); void setPosition(int position); @Override int hashCode(); @Override boolean equals(Object o); int compareTo(PageletURI l); @Override String toString(); }
PageletURIImpl implements PageletURI { @Override public boolean equals(Object o) { if (o instanceof PageletURI) { PageletURI l = (PageletURI) o; if (l.getPageURI() != null && l.getComposer() != null) return l.getPageURI().equals(pageURI) && l.getComposer().equals(composer) && l.getPosition() == position; } return false; } PageletURIImpl(ResourceURI pageURI, String composer, int position); Site getSite(); ResourceURI getPageURI(); String getComposer(); int getPosition(); void setURI(ResourceURI uri); void setComposer(String composer); void setPosition(int position); @Override int hashCode(); @Override boolean equals(Object o); int compareTo(PageletURI l); @Override String toString();  }