package com.twu.biblioteca.entity;

import org.junit.Before;
import org.junit.Test;

import java.util.Date;

import static org.junit.Assert.assertEquals;

public class BookTest {
    private Book book;

    @Before
    public void initBook() {
        book = new Book();
    }

    @Test
    public void canSetBookName() {
        String name = "Refactoring: Improving the Design of Existing Code";
        book.setName(name);
        assertEquals(name, book.getName());
    }

    @Test
    public void canSetBookAuthor() {
        String author = "Martin Fowler";
        book.setAuthor(author);
        assertEquals(author, book.getAuthor());
    }


    @Test
    public void canSetPublishedDate() {
        String date = "July 8, 1999";
        book.setPublishedDate(date);
        assertEquals(date, book.getPublishedDate());
    }

}

@@ -832,10 +832,387 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void constructorTest() %7B%0A        book = new Book(%22Refactoring: Improving the Design of Existing Code%22, %22Martin Fowler%22, %22July 8, 1999%22);%0A        assertEquals(%22Refactoring: Improving the Design of Existing Code%22, book.getName());%0A        assertEquals(%22Martin Fowler%22, book.getAuthor());%0A        assertEquals(%22July 8, 1999%22, book.getPublishedDate());%0A    %7D%0A%0A
 %7D%0A

modify some codes