Book01 { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Book01 book01 = (Book01) o; if (pubYear != book01.pubYear) return false; if (pageCount != book01.pageCount) return false; if (title != null ? !title.equals(book01.title) : book01.title != null) return false; return author != null ? author.equals(book01.author) : book01.author == null; } Book01(String title, String author, int pubYear, int pageCount); String getTitle(); String getAuthor(); int getPubYear(); int getPageCount(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void equalsTest() { final Book01 book1 = new Book01("Foo", "Bar", 2016, 500); final Book01 book2 = new Book01("Foo", "Bar", 2016, 500); assertEquals(book1, book2); }