01: /*
02: * User: mrettig
03: * Date: Jun 25, 2002
04: * Time: 1:32:48 PM
05: */
06: package net.sourceforge.jaxor.tests;
07:
08: import junit.framework.TestCase;
09: import net.sourceforge.jaxor.MetaField;
10: import net.sourceforge.jaxor.mappers.FieldAdapterImpl;
11: import net.sourceforge.jaxor.mappers.BooleanMapper;
12: import net.sourceforge.jaxor.util.SystemException;
13:
14: public class EntityFieldTest extends TestCase {
15:
16: public void testValidate() {
17: FieldAdapterImpl field = createMapper();
18: try {
19: field.validate();
20: fail("Should fail validation");
21: } catch (SystemException expected) {
22: }
23: }
24:
25: private FieldAdapterImpl createMapper() {
26: FieldAdapterImpl field = new FieldAdapterImpl(new MetaField(
27: "name", false, BooleanMapper.class), null);
28: return field;
29: }
30:
31: public void testToString() {
32: FieldAdapterImpl field = createMapper();
33: assertEquals("name = null", field.toString());
34: field.setValue(Boolean.FALSE);
35: assertEquals("name = false", field.toString());
36: }
37:
38: public void testEquals() {
39: FieldAdapterImpl field = createMapper();
40: field.setValue(Boolean.FALSE);
41:
42: FieldAdapterImpl field2 = createMapper();
43: field2.setValue(Boolean.FALSE);
44: assertEquals(field, field2);
45: }
46: }
|