Book02 { public static Book02 create(String title, @Nullable String author, int pubYear, int pageCount) { return new AutoValue_Book02(title, author, pubYear, pageCount); }  static Book02 create(String title, @Nullable String author, int pubYear, int pageCount);  }
@Test public void equalsTest() { final Book02 book1 = Book02.create("Foo", "Bar", 2016, 500); final Book02 book2 = Book02.create("Foo", "Bar", 2016, 500); assertEquals(book1, book2); }
@Test public void notEqualsTest() { final Book02 book1 = Book02.create("Foo", "Bar", 2016, 500); final Book02 book2 = Book02.create("Abc", "Xyz", 2014, 250); assertNotEquals(book1, book2); }
@Test public void hashSetTest() { final Book02 book1 = Book02.create("Foo", "Bar", 2016, 500); final Book02 book2 = Book02.create("Foo", "Bar", 2016, 500); final Book02 book3 = Book02.create("Foo", "Bar", 2016, 500); final HashSet<Book02> set = new HashSet<>(); set.add(book1); set.add(book2); set.add(book3); assertThat(set.size(), is(1)); }
@Test(expected = NullPointerException.class) public void nullCheckTest() { Book02.create(null, "Bar", 2016, 500); }