RecentPresentation extends File implements Comparable<File> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; final RecentPresentation that = (RecentPresentation) o; return getNormalizedPath().equals(that.getNormalizedPath()); } RecentPresentation(final String path, final LocalDateTime openedDateTime); LocalDateTime getOpenedDateTime(); void setOpenedDateTime(LocalDateTime openedDateTime); String getId(); String getNormalizedPath(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(File o);  }
@Test @DisplayName("is equal to itself") void isEqualToItself() { final RecentPresentation presentation = new RecentPresentation("presentation1.sfx", null); assertTrue(presentation.equals(presentation)); }
@Test @DisplayName("is not equal to a null object") void notEqualToNull() { final RecentPresentation presentation = new RecentPresentation("presentation1.sfx", null); assertFalse(presentation.equals(null)); }
@Test @DisplayName("is not equal to an object of different type") void notEqualToDifferentType() { final RecentPresentation presentation = new RecentPresentation("presentation1.sfx", null); assertFalse(presentation.equals("Hello")); }
@Test @DisplayName("is equal to another with same normalized path") void equalIfSameNormalizedPath() { final RecentPresentation presentation = new RecentPresentation("presentation1.sfx", null); final RecentPresentation another = new RecentPresentation("presentation1.sfx", null); assertTrue(presentation.equals(another)); }