001 /** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.krad.bo; 017 018 019 import org.junit.After; 020 import org.junit.Before; 021 import org.junit.Test; 022 023 import java.sql.Timestamp; 024 import java.util.Calendar; 025 import java.util.Date; 026 027 import static org.junit.Assert.assertEquals; 028 029 /** 030 * SessionDocumentTest tests SessionDocument getters and setters 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 * 034 */ 035 public class SessionDocumentTest { 036 037 SessionDocument dummySessionDocument; 038 039 @Before 040 public void setUp() throws Exception { 041 dummySessionDocument = new SessionDocument(); 042 } 043 044 @After 045 public void tearDown() throws Exception { 046 dummySessionDocument = null; 047 } 048 049 @Test 050 /** 051 * tests serializedDocumentForm getter and setter 052 */ 053 public void testSerializedDocumentForm(){ 054 055 byte[] dummyByte = "dummy".getBytes(); 056 dummySessionDocument.setSerializedDocumentForm(dummyByte); 057 assertEquals("Testing SerializedDocumentForm in SessionDocumentService","dummy", new String(dummySessionDocument.getSerializedDocumentForm())); 058 } 059 060 @Test 061 /** 062 * tests sessionId getter and setter 063 */ 064 public void testSessionId(){ 065 dummySessionDocument.setSessionId("dummySeesionID"); 066 assertEquals("Testing SessionId in SessionDocumentService","dummySeesionID",dummySessionDocument.getSessionId()); 067 } 068 069 070 @Test 071 /** 072 * tests lastUpdatedDate getter and setter 073 */ 074 public void testLastUpdatedDate(){ 075 Calendar calendar = Calendar.getInstance(); 076 Date now = calendar.getTime(); 077 Timestamp currentTimestamp = new Timestamp(now.getTime()); 078 dummySessionDocument.setLastUpdatedDate(currentTimestamp); 079 assertEquals("Testing LastUpdatedDate in SessionDocumentService",currentTimestamp,dummySessionDocument.getLastUpdatedDate()); 080 } 081 082 @Test 083 /** 084 * tests documentNumber getter and setter 085 */ 086 public void testDocumentNumber(){ 087 dummySessionDocument.setDocumentNumber("dummyDocumentNumber"); 088 assertEquals("Testing DocumentNumber in SessionDocumentService","dummyDocumentNumber",dummySessionDocument.getDocumentNumber()); 089 } 090 091 092 @Test 093 /** 094 * tests principalId getter and setter 095 */ 096 public void testPrincipalId(){ 097 dummySessionDocument.setPrincipalId("dummyPrincipalId"); 098 assertEquals("Testing PrincipalId in SessionDocumentService","dummyPrincipalId",dummySessionDocument.getPrincipalId()); 099 } 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 }