package pl.org.kata.test.festhamcrest; /** * User: MichaƂ Lewandowski * Date: 19.05.2013 * Time: 12:02 */ public class Book { private String author; private String title; private Integer pages; public Book(String author, String title, Integer pages) { this.author = author; this.title = title; this.pages = pages; } public Book() {} public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Integer getPages() { return pages; } public void setPages(Integer pages) { this.pages = pages; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Book book = (Book) o; if (author != null ? !author.equals(book.author) : book.author != null) return false; if (pages != null ? !pages.equals(book.pages) : book.pages != null) return false; if (title != null ? !title.equals(book.title) : book.title != null) return false; return true; } @Override public int hashCode() { int result = author != null ? author.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (pages != null ? pages.hashCode() : 0); return result; } @Override public String toString() { return "Book{" + "author='" + author + '\'' + ", title='" + title + '\'' + ", pages=" + pages + '}'; } }