1 package org.melati.poem.test;
2
3 import java.util.Enumeration;
4
5 import org.melati.poem.ColumnTypePoemType;
6 import org.melati.poem.PoemTypeFactory;
7 import org.melati.poem.SQLPoemType;
8 import org.melati.poem.PoemLocale;
9
10
11
12
13
14
15 @SuppressWarnings("rawtypes")
16 public class ColumnTypePoemTypeTest extends SQLPoemTypeSpec {
17
18 public ColumnTypePoemTypeTest() {
19 }
20
21 public ColumnTypePoemTypeTest(String name) {
22 super(name);
23 }
24
25
26
27
28
29
30 @SuppressWarnings("unchecked")
31 void setObjectUnderTest() {
32 it = new ColumnTypePoemType(getDb());
33 }
34
35 public void testPossibleRaws() {
36 super.testPossibleRaws();
37 Enumeration<?> them = it.possibleRaws();
38 int count = 0;
39 while(them.hasMoreElements()) {
40 them.nextElement();
41 count++;
42
43
44 }
45 if (getDb().getDbms().canDropColumns())
46 assertEquals(26,count);
47 }
48
49 public void testRawOfCooked() {
50 super.testRawOfCooked();
51 assertEquals(new Integer(-1),it.rawOfCooked(PoemTypeFactory.TROID));
52 }
53
54 public void testCookedOfRaw() {
55 super.testCookedOfRaw();
56 assertEquals(PoemTypeFactory.TROID,it.cookedOfRaw(new Integer(-1)));
57 }
58
59 public void testStringOfCooked() {
60 super.testStringOfCooked();
61 assertEquals("BOOLEAN", it.stringOfCooked(PoemTypeFactory.BOOLEAN, PoemLocale.HERE, 0));
62 }
63
64
65
66
67 public void testQuotedRaw() {
68 assertEquals(((SQLPoemType)it).sqlDefaultValue(getDb().getDbms()),
69 ((SQLPoemType)it).quotedRaw(((SQLPoemType)it).rawOfString(
70 ((SQLPoemType)it).sqlDefaultValue(getDb().getDbms()))));
71
72 }
73
74 }