コード例 #1
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);
  }
コード例 #2
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");
  }