package com.twu.biblioteca;


import org.junit.Test;

import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

import static org.junit.Assert.assertEquals;

public class LibraryTest {

    @Test
    public void shouldDisplayWelcomeMessageWhenApplicationStart() {
        TestOutputWriter outputWriter = new TestOutputWriter(null);
        Library library = new Library(outputWriter);
        String expectedMessage = "WELCOME";
        assertEquals(expectedMessage, library.getWelcomeMessage());
    }

    @Test
    public void shouldDisplayListOfBooksWithDetails() {
        TestOutputWriter outputWriter = new TestOutputWriter(null);
        ArrayList<Book> expectedBookList = new ArrayList<Book>();
        expectedBookList.add(new Book( "Head First Java","Kathy Sierra,Bert Bates", 2015));
        expectedBookList.add(new Book("Native Son","Richard Wrigh", 1940));
        expectedBookList.add(new Book("Animal Farm","George Orwell", 1945));
        Library library = new Library(outputWriter);
        assertEquals(expectedBookList, library.getListOfBooks());
    }

    @Test
    public void shouldDisplayMenuItemsOnScreen() {
        TestOutputWriter outputWriter = new TestOutputWriter(new
                BufferedWriter(new OutputStreamWriter(System.out)));
        ArrayList<String> expectedBookList = new ArrayList<String>();
        expectedBookList.add("WELCOME");
        expectedBookList.add("Head First Java");
        expectedBookList.add("Native Son");
        expectedBookList.add("Animal Farm");
        Library library = new Library(outputWriter);
        library.startLibrary();
        assertEquals(expectedBookList, outputWriter.getOutputs());

    }


}

@@ -1440,16 +1440,26 @@
 ist.add(
+new Book( 
 %22Head Fi
@@ -1467,16 +1467,81 @@
 st Java%22
+,%22Kathy Sierra,Bert%22 +%0A                %22 Bates%22, 2015).toString()
 );%0A     
@@ -1564,16 +1564,25 @@
 ist.add(
+new Book(
 %22Native 
@@ -1585,16 +1585,50 @@
 ive Son%22
+,%22Richard Wrigh%22, 1940).toString()
 );%0A     
@@ -1651,16 +1651,25 @@
 ist.add(
+new Book(
 %22Animal 
@@ -1673,16 +1673,67 @@
 al Farm%22
+,%22George Orwell%22, 1945)%0A                .toString()
 );%0A     

Implement functionality to display list of books with details