Link implements ParagraphElement { @Override public boolean equals(final Object o) { if (o == this) { return true; } if (!(o instanceof Link)) { return false; } final Link other = (Link) o; return this.href.equals(other.href) && this.text.equals(other.text); } Link(final String text, final TextStyle ts, final String href); static LinkBuilder builder(final String text); @Deprecated static Link create(final String text, final TextStyle ts, final Table table); @Deprecated static Link create(final String text, final Table table); @Deprecated static Link create(final String text, final TextStyle ts, final String relativeRef); @Deprecated static Link create(final String text, final String relativeRef); @Deprecated static Link create(final String text, final TextStyle ts, final File file); @Deprecated static Link create(final String text, final File file); @Deprecated static Link create(final String text, final TextStyle ts, final URL url); @Deprecated static Link create(final String text, final URL url); @Deprecated static Link create(final String text, final TextStyle ts, final URI uri); @Deprecated static Link create(final String text, final TableRef tableRef); @Deprecated static Link create(final String text, final TextStyle ts, final TableRef tableRef); @Deprecated static Link create(final String text, final URI uri); @Override void appendXMLContent(final XMLUtil util, final Appendable appendable); @Override void addEmbeddedStylesFromFooterHeader(final StylesContainer stylesContainer); @Override void addEmbeddedStylesFromCell(final StylesContainer stylesContainer); @Override boolean equals(final Object o); @Override final int hashCode();  }
@Test public void testEquals() { final Link link1 = Link.builder("ok").to("ref1").build(); final Link link2 = Link.builder("ok").to("ref2").build(); final Link link3 = Link.builder("ok3").to("ref1").build(); Assert.assertEquals(link1, link1); Assert.assertNotEquals(new Object(), link1); Assert.assertNotEquals(link1, new Object()); Assert.assertNotEquals(link2, link1); Assert.assertNotEquals(link1, link2); Assert.assertNotEquals(link3, link1); Assert.assertNotEquals(link1, link3); }