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
45
46
47
48
49 @After
50 public void tearDown() throws Exception {
51 dummySessionDocument = null;
52 }
53
54 @Test
55 public void testSerializedDocumentForm(){
56
57 byte[] dummyByte = "dummy".getBytes();
58 dummySessionDocument.setSerializedDocumentForm(dummyByte);
59 assertEquals("Testing SerializedDocumentForm in SessionDocumentService","dummy", new String(dummySessionDocument.getSerializedDocumentForm()));
60 }
61
62 @Test
63 public void testSessionId(){
64 dummySessionDocument.setSessionId("dummySeesionID");
65 assertEquals("Testing SessionId in SessionDocumentService","dummySeesionID",dummySessionDocument.getSessionId());
66 }
67
68
69 @Test
70 public void testLastUpdatedDate(){
71 Calendar calendar = Calendar.getInstance();
72 Date now = calendar.getTime();
73 Timestamp currentTimestamp = new Timestamp(now.getTime());
74 dummySessionDocument.setLastUpdatedDate(currentTimestamp);
75 assertEquals("Testing LastUpdatedDate in SessionDocumentService",currentTimestamp,dummySessionDocument.getLastUpdatedDate());
76 }
77
78 @Test
79 public void testDocumentNumber(){
80 dummySessionDocument.setDocumentNumber("dummyDocumentNumber");
81 assertEquals("Testing DocumentNumber in SessionDocumentService","dummyDocumentNumber",dummySessionDocument.getDocumentNumber());
82 }
83
84
85 @Test
86 public void testPrincipalId(){
87 dummySessionDocument.setPrincipalId("dummyPrincipalId");
88 assertEquals("Testing PrincipalId in SessionDocumentService","dummyPrincipalId",dummySessionDocument.getPrincipalId());
89 }
90
91 @Test
92 public void testIpAddress(){
93 dummySessionDocument.setIpAddress("dummyIpAddress");
94 assertEquals("Testing IpAddress in SessionDocumentService","dummyIpAddress",dummySessionDocument.getIpAddress());
95 }
96
97 @Test
98 public void testEncrypted(){
99 dummySessionDocument.setEncrypted(true);
100 assertEquals("Testing Encrypted in SessionDocumentService",true,dummySessionDocument.isEncrypted());
101 }
102 }