View Javadoc

1   /**
2    * Copyright 2005-2011 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   * This is a description of what this class does - chang don't forget to fill this in. 
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  	/**
45  	 * This method ...
46  	 * 
47  	 * @throws java.lang.Exception
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 }