Added tests for service-layer pattern

This commit is contained in:
Jeroen Meulemeester
2015-12-29 01:19:46 +01:00
parent 52c483f1d0
commit fcfdbe71f5
11 changed files with 453 additions and 29 deletions

View File

@@ -0,0 +1,35 @@
package com.iluwatar.servicelayer.spellbook;
import com.iluwatar.servicelayer.common.BaseDaoTest;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Date: 12/28/15 - 11:44 PM
*
* @author Jeroen Meulemeester
*/
public class SpellbookDaoImplTest extends BaseDaoTest<Spellbook, SpellbookDaoImpl> {
public SpellbookDaoImplTest() {
super(Spellbook::new, new SpellbookDaoImpl());
}
@Test
public void testFindByName() throws Exception {
final SpellbookDaoImpl dao = getDao();
final List<Spellbook> allBooks = dao.findAll();
for (final Spellbook book : allBooks) {
final Spellbook spellByName = dao.findByName(book.getName());
assertNotNull(spellByName);
assertEquals(book.getId(), spellByName.getId());
assertEquals(book.getName(), spellByName.getName());
}
}
}