1 package org.melati.poem.test;
2
3 import java.text.DateFormat;
4 import java.util.Enumeration;
5
6 import org.melati.poem.IntegrityFixPoemType;
7 import org.melati.poem.SQLPoemType;
8 import org.melati.poem.StandardIntegrityFix;
9 import org.melati.poem.PoemLocale;
10
11
12
13
14
15
16 public class NotNullablelntegrityFixPoemTypeTest extends SQLPoemTypeSpec<Integer> {
17
18 public NotNullablelntegrityFixPoemTypeTest() {
19 }
20
21 public NotNullablelntegrityFixPoemTypeTest(String name) {
22 super(name);
23 }
24
25 void setObjectUnderTest() {
26 it = new IntegrityFixPoemType(false);
27 }
28
29 public void testPossibleRaws() {
30 super.testPossibleRaws();
31 Enumeration<Integer> them = it.possibleRaws();
32 int count = 0;
33 while(them.hasMoreElements()) {
34 them.nextElement();
35 count++;
36 }
37 assertEquals(3,count);
38 }
39
40 public void testRawOfCooked() {
41 super.testRawOfCooked();
42 assertEquals(StandardIntegrityFix.prevent.getIndex(),
43 it.rawOfCooked(StandardIntegrityFix.prevent));
44 }
45
46 public void testStringOfCooked() {
47 super.testStringOfCooked();
48 assertEquals("prevent",
49 it.stringOfCooked(StandardIntegrityFix.prevent, PoemLocale.HERE, DateFormat.MEDIUM));
50 }
51
52
53
54
55 public void testQuotedRaw() {
56 assertEquals(((SQLPoemType<Integer>)it).sqlDefaultValue(getDb().getDbms()) ,
57 ((SQLPoemType<Integer>)it).quotedRaw(((SQLPoemType<Integer>)it).rawOfString(
58 ((SQLPoemType<Integer>)it).sqlDefaultValue(getDb().getDbms()))));
59
60 }
61
62 }