Ejemplo n.º 1
0
 @Test(dependsOnMethods = "update")
 public void delete() throws Exception {
   InventoryItem inventoryItem = repository.findOne(id);
   repository.delete(inventoryItem);
   InventoryItem newInventoryItem = repository.findOne(id);
   org.testng.Assert.assertNull(newInventoryItem);
 }
Ejemplo n.º 2
0
  @Test
  public void create() throws Exception {
    List<Consumtion> consumtionList = new ArrayList<Consumtion>();
    List<Return> returnList = new ArrayList<Return>();
    Map<String, String> values = new HashMap<String, String>();

    values.put("code", "00789");
    values.put("name", "Book");
    values.put("description", "About a group of four intelligent individuals");

    InventoryItem inventoryItem =
        InventoryItemFactory.createInventoryItem(values, consumtionList, returnList);

    repository.save(inventoryItem);
    id = inventoryItem.getId();
    Assert.assertNotNull(inventoryItem);
  }
Ejemplo n.º 3
0
  @Test(dependsOnMethods = "read")
  public void update() throws Exception {
    List<Consumtion> consumtionList = new ArrayList<Consumtion>();
    List<Return> returnList = new ArrayList<Return>();
    Map<String, String> values = new HashMap<String, String>();

    values.put("code", "00789");
    values.put("name", "Book");
    values.put("description", "About a group of four intelligent individuals");

    InventoryItem inventoryItem =
        InventoryItemFactory.createInventoryItem(values, consumtionList, returnList);

    InventoryItem newInventoryItem =
        new InventoryItem.Builder(inventoryItem.getCode()).copy(inventoryItem).name("DVD").build();
    InventoryItem updateInventoryItem = repository.findOne(id);
    org.testng.Assert.assertEquals(updateInventoryItem.getName(), "DVD");
  }
Ejemplo n.º 4
0
 @Test(dependsOnMethods = "create")
 public void read() throws Exception {
   InventoryItem inventoryItem = repository.findOne(id);
   Assert.assertNotNull(inventoryItem);
 }