@Override
 public void doUpdate() {
   MdoTableAsEnum codeToBeUpdated = new MdoTableAsEnum();
   // Use the existing data in database
   codeToBeUpdated.setId(4L);
   BigDecimal rateToBeUpdated = basicTestRate.add(new BigDecimal(0.4f));
   try {
     // Create new bean to be updated
     IMdoBean beanToBeUpdated =
         this.getInstance().insert(createNewBean(codeToBeUpdated, rateToBeUpdated));
     assertTrue(
         "IMdoBean must be instance of " + ValueAddedTax.class,
         beanToBeUpdated instanceof ValueAddedTax);
     ValueAddedTax castedBean = (ValueAddedTax) beanToBeUpdated;
     assertEquals(
         "ValueAddedTax code must be equals to unique key", codeToBeUpdated, castedBean.getCode());
     assertEquals("ValueAddedTax rate must be equals", rateToBeUpdated, castedBean.getRate());
     assertFalse("ValueAddedTax must not be deleted", castedBean.isDeleted());
     // Update the created bean
     codeToBeUpdated = new MdoTableAsEnum();
     // Use the existing data in database
     codeToBeUpdated.setId(5L);
     castedBean.setRate(basicTestRate.add(new BigDecimal(0.5f)));
     castedBean.setDeleted(true);
     this.getInstance().update(castedBean);
     // Reload the modified bean
     ValueAddedTax updatedBean = new ValueAddedTax();
     updatedBean.setId(castedBean.getId());
     this.getInstance().load(updatedBean);
     assertEquals(
         "ValueAddedTax code must be equals to unique key",
         castedBean.getCode().getId(),
         updatedBean.getCode().getId());
     assertEquals(
         "ValueAddedTax rate must be equals",
         super.decimalFormat.format(castedBean.getRate()),
         super.decimalFormat.format(updatedBean.getRate()));
     assertTrue("ValueAddedTax must be deleted", updatedBean.isDeleted());
   } catch (Exception e) {
     fail(e.getMessage());
   }
 }
  @Override
  public void doUpdateFieldsAndDeleteByKeysSpecific() {
    MdoTableAsEnum codeToBeUpdated = new MdoTableAsEnum();
    // Use the existing data in database
    codeToBeUpdated.setId(5L);
    BigDecimal rateToBeUpdated = basicTestRate.add(new BigDecimal(0.4f));
    try {
      // Create new bean to be updated
      IMdoBean beanToBeUpdated =
          this.getInstance().insert(createNewBean(codeToBeUpdated, rateToBeUpdated));
      assertTrue(
          "IMdoBean must be instance of " + ValueAddedTax.class,
          beanToBeUpdated instanceof ValueAddedTax);
      ValueAddedTax castedBean = (ValueAddedTax) beanToBeUpdated;
      assertEquals(
          "ValueAddedTax code must be equals to unique key", codeToBeUpdated, castedBean.getCode());
      assertEquals("ValueAddedTax rate must be equals", rateToBeUpdated, castedBean.getRate());
      assertFalse("ValueAddedTax must not be deleted", castedBean.isDeleted());

      // Update the created bean
      Map<String, Object> fields = new HashMap<String, Object>();
      Map<String, Object> keys = new HashMap<String, Object>();
      castedBean.setRate(BigDecimal.ONE);
      fields.put("rate", castedBean.getRate());
      keys.put("id", castedBean.getId());
      this.getInstance().updateFieldsByKeys(fields, keys);
      // Reload the modified bean
      ValueAddedTax updatedBean = (ValueAddedTax) createNewBean();
      updatedBean.setId(castedBean.getId());
      this.getInstance().load(updatedBean);
      assertEquals("Check updated fields ", castedBean.getRate(), updatedBean.getRate());

      // Delete the bean by keys
      // Take the fields as keys
      super.doDeleteByKeysSpecific(updatedBean, fields);
    } catch (Exception e) {
      fail(MdoTestCase.DEFAULT_FAILED_MESSAGE + " " + e.getMessage());
    }
  }
 private IMdoBean createNewBean(MdoTableAsEnum code, BigDecimal rate) {
   ValueAddedTax newBean = new ValueAddedTax();
   newBean.setCode(code);
   newBean.setRate(rate);
   return newBean;
 }