1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.bo;
17
18
19 import org.junit.After;
20 import org.junit.Before;
21 import org.junit.Test;
22
23 import java.sql.Timestamp;
24 import java.util.Calendar;
25 import java.util.Date;
26
27 import static org.junit.Assert.assertEquals;
28
29
30
31
32
33
34
35 public class SessionDocumentTest {
36
37 SessionDocument dummySessionDocument;
38
39 @Before
40 public void setUp() throws Exception {
41 dummySessionDocument = new SessionDocument();
42 }
43
44 @After
45 public void tearDown() throws Exception {
46 dummySessionDocument = null;
47 }
48
49 @Test
50
51
52
53 public void testSerializedDocumentForm(){
54
55 byte[] dummyByte = "dummy".getBytes();
56 dummySessionDocument.setSerializedDocumentForm(dummyByte);
57 assertEquals("Testing SerializedDocumentForm in SessionDocumentService","dummy", new String(dummySessionDocument.getSerializedDocumentForm()));
58 }
59
60 @Test
61
62
63
64 public void testSessionId(){
65 dummySessionDocument.setSessionId("dummySeesionID");
66 assertEquals("Testing SessionId in SessionDocumentService","dummySeesionID",dummySessionDocument.getSessionId());
67 }
68
69
70 @Test
71
72
73
74 public void testLastUpdatedDate(){
75 Calendar calendar = Calendar.getInstance();
76 Date now = calendar.getTime();
77 Timestamp currentTimestamp = new Timestamp(now.getTime());
78 dummySessionDocument.setLastUpdatedDate(currentTimestamp);
79 assertEquals("Testing LastUpdatedDate in SessionDocumentService",currentTimestamp,dummySessionDocument.getLastUpdatedDate());
80 }
81
82 @Test
83
84
85
86 public void testDocumentNumber(){
87 dummySessionDocument.setDocumentNumber("dummyDocumentNumber");
88 assertEquals("Testing DocumentNumber in SessionDocumentService","dummyDocumentNumber",dummySessionDocument.getDocumentNumber());
89 }
90
91
92 @Test
93
94
95
96 public void testPrincipalId(){
97 dummySessionDocument.setPrincipalId("dummyPrincipalId");
98 assertEquals("Testing PrincipalId in SessionDocumentService","dummyPrincipalId",dummySessionDocument.getPrincipalId());
99 }
100
101 @Test
102
103
104
105 public void testIpAddress(){
106 dummySessionDocument.setIpAddress("dummyIpAddress");
107 assertEquals("Testing IpAddress in SessionDocumentService","dummyIpAddress",dummySessionDocument.getIpAddress());
108 }
109
110 @Test
111
112
113
114 public void testEncrypted(){
115 dummySessionDocument.setEncrypted(true);
116 assertEquals("Testing Encrypted in SessionDocumentService",true,dummySessionDocument.isEncrypted());
117 }
118 }