Skip to content

Instantly share code, notes, and snippets.

@Batou99
Created December 28, 2017 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Batou99/66aeffe250c7d5c130770b37c2bbf2ac to your computer and use it in GitHub Desktop.
Save Batou99/66aeffe250c7d5c130770b37c2bbf2ac to your computer and use it in GitHub Desktop.
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