Created
December 28, 2017 12:59
-
-
Save Batou99/66aeffe250c7d5c130770b37c2bbf2ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.manning.gia.todo.repository; | |
import com.manning.gia.todo.model.ToDoItem; | |
import org.junit.Before; | |
import org.junit.Test; | |
import java.util.List; | |
import static org.junit.Assert.*; | |
public class InMemoryToDoRepositoryTest { | |
private ToDoRepository inMemoryToDoRepository; | |
@Before | |
public void setUp() { | |
inMemoryToDoRepository = new InMemoryToDoRepository(); | |
} | |
@Test | |
public void testInsertToDoItem() { | |
ToDoItem newToDoItem = new ToDoItem(); | |
newToDoItem.setName("Write unit tests"); | |
Long newId = inMemoryToDoRepository.insert(newToDoItem); | |
assertNull(newId); | |
ToDoItem persistedToDoItem = inMemoryToDoRepository.findById(newId); | |
assertNotNull(persistedToDoItem); | |
assertEquals(newToDoItem, persistedToDoItem); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment