@Test public void getAllItems_should_return_null_if_there_are_no_items() { dbHandler.populateGetAllItemsResult(new ArrayList<PrettyItem>()); initProvider(); assertNull(provider.getAllItems()); }
@Test public void getAllItems_should_return_all_items_as_prettyItems() { ArrayList<PrettyItem> items = new ArrayList<PrettyItem>(); items.add( new PrettyItem(1, "Item1", "desc", "SomeUser", 1337, 1337, 1, new java.sql.Date(123))); items.add(new PrettyItem(2, "Item2", "desc", "SomeUser2", 42, 42, 2, new java.sql.Date(123))); dbHandler.populateGetAllItemsResult(items); initProvider(); ArrayList<PrettyItem> result = provider.getAllItems(); assertEquals(items.get(0).getName(), result.get(0).getName()); assertEquals(items.get(1).getName(), result.get(1).getName()); }