package com.book.app.repository;

import com.book.app.domain.Book;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.testng.Assert.*;


public class BookRepositoryListTest {

    private BookRepositoryList bookRepo;

    @Test
    public void shouldInsert() throws Exception {
        bookRepo = new BookRepositoryList();
        String someAuthor = "Some Author";
        String someTitle = "Some Title";
        Double somePrice = 199.99;
        Book someInsert = new Book(someAuthor, someTitle, somePrice);
        Book someResponse = bookRepo.insert(someInsert);

        assertEquals(someResponse.getAuthor(), someAuthor);
        assertEquals(someResponse.getTitle(), someTitle);
        assertEquals(someResponse.getPrice(), somePrice);
    }
}

@@ -114,16 +114,44 @@
 .Test;%0A%0A
+import java.util.Optional;%0A%0A
 import s
@@ -260,16 +260,30 @@
 kRepo;%0A%0A
+    // insert%0A
     @Tes
@@ -300,17 +300,23 @@
 ic void 
-s
+insertS
 houldIns
@@ -813,11 +813,1464 @@
 );%0A    %7D
+%0A%0A    // findOne%0A    @Test%0A    public void findOnefindsObject() throws Exception %7B%0A        bookRepo = new BookRepositoryList();%0A        String someAuthor = %22Some Author%22;%0A        String someTitle = %22Some Title%22;%0A        Double somePrice = 199.99;%0A        Book someBook = new Book(someAuthor, someTitle, somePrice);%0A        Optional%3CBook%3E result = bookRepo.findOne(bookRepo.insert(someBook).getId());%0A%0A        assertTrue(result.isPresent());%0A        assertEquals(result.get(), someBook);%0A    %7D%0A%0A    @Test%0A    public void findOnefindsNothing() throws Exception %7B%0A        bookRepo = new BookRepositoryList();%0A        Optional%3CBook%3E result = bookRepo.findOne(%22some-id%22);%0A%0A        assertFalse(result.isPresent());%0A    %7D%0A%0A    // list%0A    @Test%0A    public void listIsEmpty() %7B%0A        bookRepo = new BookRepositoryList();%0A%0A        assertTrue(bookRepo.list().isEmpty());%0A    %7D%0A%0A    @Test%0A    public void listContainsElements() %7B%0A        bookRepo = new BookRepositoryList();%0A        Book someBook = new Book(%22Some Author%22, %22Some Title%22, 19.99);%0A        Book someOtherBook = new Book(%22Some Other Author%22, %22Some Strange Title%22, 99.99);%0A        bookRepo.insert(someBook);%0A        bookRepo.insert(someOtherBook);%0A%0A        assertFalse(bookRepo.list().isEmpty());%0A        assertTrue(bookRepo.list().size() == 2);%0A        assertEquals(bookRepo.list().get(0).getTitle(), %22Some Title%22);%0A        assertEquals(bookRepo.list().get(1).getTitle(), %22Some Strange Title%22);%0A    %7D
 %0A%7D%0A

Add tests