All pastes #460065 Raw Edit

Mine

public text v1 · immutable
#460065 ·published 2007-04-26 20:42 UTC
rendered paste body
  @Test
  public void testAddAndGetFeedCategory() {
    try {
      Category category = (Category) createFeedCategory();
      DynamicDAO.save(category);
      Collection<ICategory> categories = DynamicDAO.loadAll(ICategory.class);
      assertEquals(1, categories.size());
      category.setId(categories.iterator().next().getId());
      assertTrue(category.isIdentical(categories.iterator().next()));
      DynamicDAO.deleteAll(categories);
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }

  /**
   * Adds, retrieves and checks if the added object matches the retrieved one.
   */
  public void testAddAndGetNewsCategory() {
    try {
      Category category = (Category) createNewsCategory();
      DynamicDAO.save(category);
      Collection<ICategory> categories = DynamicDAO.loadAll(ICategory.class);
      assertEquals(1, categories.size());
      category.setId(categories.iterator().next().getId());
      assertTrue(category.isIdentical(categories.iterator().next()));
      DynamicDAO.deleteAll(categories);
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }