View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * SessionDocumentTest tests SessionDocument getters and setters
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
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       * tests serializedDocumentForm getter and setter
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       * tests sessionId getter and setter
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       * tests lastUpdatedDate getter and setter
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       * tests documentNumber getter and setter
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       * tests principalId getter and setter
95       */
96  	public void testPrincipalId(){
97  		dummySessionDocument.setPrincipalId("dummyPrincipalId");
98  		assertEquals("Testing PrincipalId in SessionDocumentService","dummyPrincipalId",dummySessionDocument.getPrincipalId());
99  	}
100 
101 	@Test
102     /**
103      * tests ipAddress getter and setter
104      */
105 	public void testIpAddress(){
106 		dummySessionDocument.setIpAddress("dummyIpAddress");
107 		assertEquals("Testing IpAddress in SessionDocumentService","dummyIpAddress",dummySessionDocument.getIpAddress());
108 	}
109 
110 	@Test
111     /**
112      * tests encrypted getter and setter
113      */
114 	public void testEncrypted(){
115 		dummySessionDocument.setEncrypted(true);
116 		assertEquals("Testing Encrypted in SessionDocumentService",true,dummySessionDocument.isEncrypted());
117 	}
118 }