1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.cdm.hibernate;
|
5
|
|
6
|
import java.io.Serializable;
|
7
|
|
8
|
import org.junit.Assert;
|
9
|
import org.junit.Before;
|
10
|
import org.junit.Test;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment.Shift;
|
13
|
|
14
|
/**
|
15
|
* @author a.mueller
|
16
|
*
|
17
|
*/
|
18
|
public class ShiftUsertTypeTest {
|
19
|
|
20
|
private ShiftUserType shiftUserType;
|
21
|
|
22
|
/**
|
23
|
* @throws java.lang.Exception
|
24
|
*/
|
25
|
@Before
|
26
|
public void setUp() throws Exception {
|
27
|
shiftUserType = new ShiftUserType();
|
28
|
}
|
29
|
|
30
|
/**
|
31
|
* Test method for {@link eu.etaxonomy.cdm.hibernate.ShiftUserType#deepCopy(java.lang.Object)}.
|
32
|
*/
|
33
|
@Test
|
34
|
public void testDeepCopyObject() {
|
35
|
//TODO
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* Test method for {@link eu.etaxonomy.cdm.hibernate.ShiftUserType#disassemble(java.lang.Object)}.
|
40
|
*/
|
41
|
@Test
|
42
|
public void testDisassembleObject() {
|
43
|
Serializable nullValue = this.shiftUserType.disassemble(null);
|
44
|
Assert.assertNull(nullValue);
|
45
|
Serializable emptyValue = this.shiftUserType.disassemble(new Shift[0]);
|
46
|
Assert.assertEquals("", emptyValue);
|
47
|
Serializable singleValue = this.shiftUserType.disassemble(new Shift[]{new Shift(2, 3)});
|
48
|
Assert.assertEquals("2,3", singleValue);
|
49
|
Serializable twoValues = this.shiftUserType.disassemble(new Shift[]{new Shift(2, 3),new Shift(3, -1)});
|
50
|
Assert.assertEquals("2,3;3,-1", twoValues);
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* Test method for {@link eu.etaxonomy.cdm.hibernate.ShiftUserType#nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object)}.
|
55
|
*/
|
56
|
@Test
|
57
|
public void testNullSafeGetString() {
|
58
|
Shift[] emptyResult = shiftUserType.nullSafeGet("");
|
59
|
Assert.assertEquals(0, emptyResult.length);
|
60
|
Shift[] singleResult = shiftUserType.nullSafeGet("2,2");
|
61
|
Assert.assertEquals(1, singleResult.length);
|
62
|
}
|
63
|
|
64
|
/**
|
65
|
* Test method for {@link eu.etaxonomy.cdm.hibernate.ShiftUserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int, org.hibernate.engine.spi.SessionImplementor)}.
|
66
|
*/
|
67
|
@Test
|
68
|
public void testNullSafeSet() {
|
69
|
//TODO
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* Test method for {@link eu.etaxonomy.cdm.hibernate.ShiftUserType#returnedClass()}.
|
74
|
*/
|
75
|
@Test
|
76
|
public void testReturnedClass() {
|
77
|
Class<?> returnedClass = new ShiftUserType().returnedClass();
|
78
|
Assert.assertEquals(Shift[].class, returnedClass);
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* Test method for {@link eu.etaxonomy.cdm.hibernate.ShiftUserType#sqlTypes()}.
|
83
|
*/
|
84
|
@Test
|
85
|
public void testSqlTypes() {
|
86
|
int[] sqlTypes = new ShiftUserType().sqlTypes();
|
87
|
// Assert.assertEquals(new int[]{ Types.CLOB }, sqlTypes);
|
88
|
}
|
89
|
|
90
|
}
|