### Question:
ArchiveIdentifierVersion extends ArchiveIdentifier { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ArchiveIdentifierVersion)) { return false; } if (!super.equals(o)) { return false; } ArchiveIdentifierVersion that = (ArchiveIdentifierVersion) o; return Objects.equals(getVersion(), that.getVersion()); } ArchiveIdentifierVersion(final ArchiveType archiveType, final String name, final String version); final String getVersion(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEqualsSame() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = ai1; Assert.assertTrue("equals()", ai1.equals(ai2)); }
@Test public void testEqualsIdentical() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); Assert.assertTrue("equals()", ai1.equals(ai2)); }
@Test public void testEqualsNull() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = null; Assert.assertFalse("equals()", ai1.equals(ai2)); }
@Test public void testEqualsObject() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final Object ai2 = new Object(); Assert.assertFalse("equals()", ai1.equals(ai2)); }
@Test public void testEqualsArchiveIdentifier() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifier ai2 = new ArchiveIdentifier(ArchiveType.JAVA, NameMatchingType.PATTERN, "abc") { }; Assert.assertFalse("equals()", ai1.equals(ai2)); }
@Test public void testEqualsDifferentArchiveType() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = new ArchiveIdentifierVersion(ArchiveType.JAVASCRIPT, "abc", "1.0"); Assert.assertFalse("equals()", ai1.equals(ai2)); }
@Test public void testEqualsDifferentName() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "def", "1.0"); Assert.assertFalse("equals()", ai1.equals(ai2)); }
@Test public void testEqualsDifferentVersion() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "2.0"); Assert.assertFalse("equals()", ai1.equals(ai2)); }
@Test public void testEqualsDifferentNameAndVersion() { final ArchiveIdentifierVersion ai1 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "abc", "1.0"); final ArchiveIdentifierVersion ai2 = new ArchiveIdentifierVersion(ArchiveType.JAVA, "def", "2.0"); Assert.assertFalse("equals()", ai1.equals(ai2)); }