@Test @Ignore public void testNullValue() throws InvalidExpressionException { Entity rootEntity = record.getRootEntity(); Entity item = addItem(rootEntity, null, 5.5d); RealAttribute total = (RealAttribute) item.get("total", 0); assertEquals(Double.valueOf(0d), total.getValue().getValue()); }
@Test @Ignore public void testUpdateAttribute() throws InvalidExpressionException { Entity rootEntity = record.getRootEntity(); Entity item = addItem(rootEntity, 10, 5.5d); RealAttribute total = (RealAttribute) item.get("total", 0); RealValue calculatedTotal = total.getValue(); assertEquals(new RealValue(55d, null), calculatedTotal); // change dependent attribute IntegerAttribute qty = (IntegerAttribute) item.get("qty", 0); qty.setNumber(20); // qty.clearDependentCalculatedAttributes(); calculatedTotal = total.getValue(); assertEquals(new RealValue(110d, null), calculatedTotal); }
@Test @Ignore public void testNotNullValues() throws InvalidExpressionException { Entity rootEntity = record.getRootEntity(); Entity item = addItem(rootEntity, 10, 5.5d); RealAttribute total = (RealAttribute) item.get("total", 0); RealValue calculatedTotal = total.getValue(); assertEquals(new RealValue(55d, null), calculatedTotal); }