Created
December 29, 2017 08:17
-
-
Save Batou99/78a68707723625bf9b0dc3b43f707da8 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 H2ToDoRepositoryIntegTest { | |
private ToDoRepository h2ToDoRepository; | |
@Before | |
public void setUp() { | |
h2ToDoRepository = new H2ToDoRepository(); | |
} | |
@Test | |
public void testInsertToDoItem() { | |
ToDoItem newToDoItem = new ToDoItem(); | |
newToDoItem.setName("Write integration tests"); | |
Long newId = h2ToDoRepository.insert(newToDoItem); | |
newToDoItem.setId(newId); | |
assertNotNull(newId); | |
ToDoItem persistedToDoItem = h2ToDoRepository.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