Skip to content

Instantly share code, notes, and snippets.

@Batou99
Created December 29, 2017 08:17
Show Gist options
  • Save Batou99/78a68707723625bf9b0dc3b43f707da8 to your computer and use it in GitHub Desktop.
Save Batou99/78a68707723625bf9b0dc3b43f707da8 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 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