aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorKevin J Hoerr <khoerr@ksmpartners.com>2022-01-27 14:12:29 -0500
committerKevin J Hoerr <khoerr@ksmpartners.com>2022-01-27 14:12:29 -0500
commit615c8a0fc8d2b35da7df90115456d33444104c41 (patch)
treeaeab4261b4edaf63905bd008ce6992b0d2490916 /src/test
parent8d8d8cdd639591c0c4c49b355db1152e310c22d6 (diff)
downloadpantry-615c8a0fc8d2b35da7df90115456d33444104c41.tar.gz
pantry-615c8a0fc8d2b35da7df90115456d33444104c41.tar.bz2
pantry-615c8a0fc8d2b35da7df90115456d33444104c41.zip
Add error handling
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/dev/submelon/pantry/ItemRepositoryTests.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/java/dev/submelon/pantry/ItemRepositoryTests.java b/src/test/java/dev/submelon/pantry/ItemRepositoryTests.java
index 0989198..f2f16ce 100644
--- a/src/test/java/dev/submelon/pantry/ItemRepositoryTests.java
+++ b/src/test/java/dev/submelon/pantry/ItemRepositoryTests.java
@@ -15,13 +15,13 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class ItemRepositoryTests {
@Autowired
- private ItemRepository itemRepository;
+ private PantryItemRepository itemRepository;
@BeforeAll
public void before() throws Exception {
- Item pb = new Item("Peanut Butter", "Crunchy", "crunchy-pb", 14.0);
- Item jelly = new Item("Strawberry Preserves", "The best", "sb-preserves", 12.8);
- Item bread = new Item("Oatnut Bread", "Relatively healthy, right?", "oatnut-bread", 10);
+ PantryItem pb = new PantryItem("Peanut Butter", "Crunchy", "crunchy-pb", 14.0);
+ PantryItem jelly = new PantryItem("Strawberry Preserves", "The best", "sb-preserves", 12.8);
+ PantryItem bread = new PantryItem("Oatnut Bread", "Relatively healthy, right?", "oatnut-bread", 10);
assertNull(pb.getId());
assertNull(jelly.getId());
assertNull(bread.getId());
@@ -35,13 +35,13 @@ public class ItemRepositoryTests {
@Test
public void testFetchData() {
- Item pb = itemRepository.findByShortid("crunchy-pb");
+ PantryItem pb = itemRepository.findByShortid("crunchy-pb").get();
assertNotNull(pb);
assertEquals(14.0, pb.getQuantity());
- Iterable<Item> items = itemRepository.findAll();
+ Iterable<PantryItem> items = itemRepository.findAll();
int count = 0;
- for (Item item : items) {
+ for (PantryItem item : items) {
assertNotNull(item);
count++;
}