@Test public void testCreate() { dao.create(e1); assertNotNull(e1.getId()); Product retrieved = dao.find(e1.getId()); assertEquals("Car", retrieved.getName()); assertEquals(BigDecimal.valueOf(123.456), retrieved.getPrice()); assertEquals("brief description", retrieved.getDescription()); assertEquals(Integer.valueOf(5), retrieved.getAmount()); assertEquals(new Date(1333449110), retrieved.getCreated()); assertEquals(e1, retrieved); }
@Test public void testEdit() { dao.create(e2); e2.setName("Car"); e2.setPrice(BigDecimal.valueOf(123.456)); e2.setDescription("brief description"); e2.setAmount(5); e2.setCreated(new Date(1333449110)); dao.edit(e2); Product retrieved = dao.find(e2.getId()); assertEquals("Car", retrieved.getName()); assertEquals(BigDecimal.valueOf(123.456), retrieved.getPrice()); assertEquals("brief description", retrieved.getDescription()); assertEquals(Integer.valueOf(5), retrieved.getAmount()); assertEquals(new Date(1333449110), retrieved.getCreated()); assertEquals(e2, retrieved); }