1
2
3
4 package org.melati.poem.test;
5
6 import java.math.BigDecimal;
7
8 import org.melati.poem.BigDecimalPoemType;
9 import org.melati.poem.DoublePoemType;
10 import org.melati.poem.SQLPoemType;
11
12
13
14
15
16
17 public class NotNullableSetBigDecimalPoemTypeTest extends SQLPoemTypeSpec<BigDecimal> {
18
19
20
21
22 public NotNullableSetBigDecimalPoemTypeTest() {
23 }
24
25
26
27
28 public NotNullableSetBigDecimalPoemTypeTest(String name) {
29 super(name);
30 }
31
32
33
34
35
36 void setObjectUnderTest() {
37 it = new BigDecimalPoemType(false, 22, 2);
38 }
39
40
41
42
43 public void testGetTotalSize() {
44 assertEquals(24, ((BigDecimalPoemType)it).getTotalSize());
45 }
46
47
48
49
50 public void testWithPrecisionAndScale() {
51 BigDecimalPoemType itAlso = (BigDecimalPoemType)it;
52 assertEquals(it, itAlso.withPrecisionAndScale(itAlso.getPrecision(),itAlso.getScale()));
53 BigDecimalPoemType itClone = (BigDecimalPoemType) itAlso.withPrecisionAndScale(10,itAlso.getScale());
54 assertEquals(10, itClone.getPrecision());
55 }
56
57
58
59 public void testQuotedRaw() {
60 assertEquals(((SQLPoemType<BigDecimal>)it).sqlDefaultValue(getDb().getDbms()) ,
61 ((SQLPoemType<BigDecimal>)it).quotedRaw(((SQLPoemType<BigDecimal>)it).rawOfString(
62 ((SQLPoemType<BigDecimal>)it).sqlDefaultValue(getDb().getDbms()))));
63
64 }
65
66
67
68
69 public void testCanRepresentDoubles() {
70 assertNull(it.canRepresent(DoublePoemType.it));
71 assertNotNull(it.canRepresent(new DoublePoemType(false)));
72 }
73
74 }