View Javadoc
1   package org.melati.poem.test;
2   
3   import org.melati.poem.IntegerPoemType;
4   import org.melati.poem.ValidationPoemException;
5   import org.melati.poem.dbms.Dbms;
6   
7   /**
8    * @author timp
9    * @since 21 Dec 2006
10   *
11   */
12  public class NullableIntegerPoemTypeTest extends NotNullableIntegerPoemTypeTest {
13  
14    public NullableIntegerPoemTypeTest() {
15    }
16  
17    public NullableIntegerPoemTypeTest(String name) {
18      super(name);
19    }
20  
21    void setObjectUnderTest() {
22      it = new RangedIntegerPoemType(true, new Integer(2), new Integer(13));
23    }
24  
25    public void testToDsdType() {
26    }
27  
28    public void testAssertValidRaw() {
29      super.testAssertValidRaw();
30      try {
31        it.assertValidRaw(new Integer(0));
32        fail("Should have blown up");
33      } catch (ValidationPoemException e) {
34        e = null;
35      }
36      try {
37        it.assertValidRaw(new Integer(23));
38        fail("Should have blown up");
39      } catch (ValidationPoemException e) {
40        e = null;
41      }
42    }
43  
44  
45  
46    class RangedIntegerPoemType extends IntegerPoemType {
47      RangedIntegerPoemType(boolean nullableP, Integer low, Integer limit) {
48        super(nullableP);
49        setRawRange(low, limit);
50      }
51  
52      public String sqlDefaultValue(Dbms Any) {
53        return "2";
54      }
55      
56    }
57  }