01: /*
02: * User: Michael Rettig
03: * Date: Sep 1, 2002
04: * Time: 12:26:17 PM
05: */
06: package net.sourceforge.jaxor.example.tests;
07:
08: import net.sourceforge.jaxor.MetaRow;
09: import net.sourceforge.jaxor.example.Money;
10: import net.sourceforge.jaxor.example.domain.ObjectFactory;
11: import net.sourceforge.jaxor.example.domain.OrdersEntity;
12: import net.sourceforge.jaxor.example.domain.OrdersMetaRow;
13:
14: public class EntityGeneratorOverrideTest extends TableTestCase {
15:
16: protected MetaRow getRow() {
17: return new OrdersMetaRow();
18: }
19:
20: /**
21: * Method is created in OrderImpl class and is used as the base class for entity.
22: */
23: public void testOverride() {
24: OrdersEntity ent = ObjectFactory.createOrder(new Long(1),
25: new Long(2));
26: Money total = ent.getEquipmentCost().add(
27: ent.getSalesTax().add(ent.getShippingCharge()));
28: assertEquals(total, ent.getOrderTotal());
29: assertEquals(ent.getOrderTotal().subtract(ent.getSalesTax()),
30: ent.subtractFromTotal(ent.getSalesTax()));
31: }
32:
33: public void testGeneratedMethodWithThrowsClause() {
34: OrdersEntity ent = ObjectFactory.createOrder(new Long(1),
35: new Long(2));
36: try {
37: ent.testThrowsClause();
38: fail("Should throw exception");
39: } catch (Exception e) {
40: assertEquals("Expected Failure", e.getMessage());
41: }
42: }
43:
44: public void testDeclarationMethod() {
45: OrdersEntity ent = ObjectFactory.createOrder(new Long(1),
46: new Long(2));
47: assertEquals(5, ent.getCount());
48: }
49: }
|