1
|
/**
|
2
|
* Copyright (C) 2016 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.hibernate;
|
10
|
|
11
|
import java.io.Serializable;
|
12
|
import java.sql.Types;
|
13
|
|
14
|
import org.junit.Assert;
|
15
|
import org.junit.Before;
|
16
|
import org.junit.Test;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment.Shift;
|
19
|
|
20
|
/**
|
21
|
* @author a.mueller
|
22
|
*/
|
23
|
public class ShiftUsertTypeTest {
|
24
|
|
25
|
private ShiftUserType shiftUserType;
|
26
|
|
27
|
@Before
|
28
|
public void setUp() throws Exception {
|
29
|
shiftUserType = new ShiftUserType();
|
30
|
}
|
31
|
|
32
|
@Test
|
33
|
public void testDeepCopyObject() {
|
34
|
//TODO
|
35
|
}
|
36
|
|
37
|
@Test
|
38
|
public void testDisassembleObject() {
|
39
|
Serializable nullValue = this.shiftUserType.disassemble(null);
|
40
|
Assert.assertNull(nullValue);
|
41
|
Serializable emptyValue = this.shiftUserType.disassemble(new Shift[0]);
|
42
|
Assert.assertEquals("", emptyValue);
|
43
|
Serializable singleValue = this.shiftUserType.disassemble(new Shift[]{new Shift(2, 3)});
|
44
|
Assert.assertEquals("2,3", singleValue);
|
45
|
Serializable twoValues = this.shiftUserType.disassemble(new Shift[]{new Shift(2, 3),new Shift(3, -1)});
|
46
|
Assert.assertEquals("2,3;3,-1", twoValues);
|
47
|
}
|
48
|
|
49
|
@Test
|
50
|
public void testNullSafeGetString() {
|
51
|
Shift[] emptyResult = shiftUserType.nullSafeGet("");
|
52
|
Assert.assertEquals(0, emptyResult.length);
|
53
|
Shift[] singleResult = shiftUserType.nullSafeGet("2,2");
|
54
|
Assert.assertEquals(1, singleResult.length);
|
55
|
}
|
56
|
|
57
|
@Test
|
58
|
public void testNullSafeSet() {
|
59
|
//TODO
|
60
|
}
|
61
|
|
62
|
@Test
|
63
|
public void testReturnedClass() {
|
64
|
Class<?> returnedClass = new ShiftUserType().returnedClass();
|
65
|
Assert.assertEquals(Shift[].class, returnedClass);
|
66
|
}
|
67
|
|
68
|
@Test
|
69
|
public void testSqlTypes() {
|
70
|
int[] sqlTypes = new ShiftUserType().sqlTypes();
|
71
|
Assert.assertArrayEquals(new int[]{Types.CLOB}, sqlTypes);
|
72
|
}
|
73
|
}
|