MediaIndexElement implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MediaIndexElement other = (MediaIndexElement) obj; return Objects.equals(this.parentId, other.parentId) && Objects.equals(this.mediaType, other.mediaType) && Objects.equals(this.mimeType, other.mimeType) && Objects.equals(this.name, other.name) && Objects.equals(this.path, other.path) && Objects.equals(this.localPath, other.localPath) && Objects.equals(this.locked, other.locked); } MediaIndexElement(final String parentId, final String mediaType, final String mimeType, final String path, final String name, final boolean localPath, final boolean locked); String getParentId(); String getMediaType(); String getPath(); String getName(); boolean isLocalPath(); String getMimeType(); boolean isLocked(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquals() { MediaIndexElement element1 = new MediaIndexElement("parentId", "mediaType", "mimeType", "path", "name", true, true); MediaIndexElement element2 = new MediaIndexElement("parentId", "mediaType", "mimeType", "path", "name", true, true); MediaIndexElement element3 = new MediaIndexElement("parentId1", "mediaType", "mimeType", "path", "name", true, true); MediaIndexElement element4 = new MediaIndexElement("parentId", "mediaType1", "mimeType", "path", "name", true, true); MediaIndexElement element5 = new MediaIndexElement("parentId", "mediaType", "mimeType", "path1", "name", true, true); MediaIndexElement element6 = new MediaIndexElement("parentId", "mediaType", "mimeType", "path", "name1", false, true); MediaIndexElement element7 = new MediaIndexElement("parentId", "mediaType", "mimeType1", "path", "name1", false, true); MediaIndexElement element8 = new MediaIndexElement("parentId", "mediaType", "mimeType1", "path", "name", false, false); assertTrue(element1.isLocalPath()); assertTrue(element1.isLocked()); assertNotNull(element1.getMimeType()); assertEquals(element1, element1); assertEquals(element1, element2); assertNotEquals(element1, null); assertNotEquals(element1, "element1"); assertNotEquals(element1, element3); assertNotEquals(element1, element4); assertNotEquals(element1, element5); assertNotEquals(element1, element6); assertNotEquals(element1, element7); assertNotEquals(element1, element8); }