コード例 #1
0
  @Test
  public void getAllItems_should_return_null_if_there_are_no_items() {
    dbHandler.populateGetAllItemsResult(new ArrayList<PrettyItem>());
    initProvider();

    assertNull(provider.getAllItems());
  }
コード例 #2
0
  @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());
  }