001: /**
002: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the latest version of the GNU Lesser General
006: * Public License as published by the Free Software Foundation;
007: *
008: * This program is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: * GNU Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public License
014: * along with this program (LICENSE.txt); if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
016: *
017: * Based on code generated by Agitar build: Agitator Version 1.0.2.000071 (Build date: Jan 12, 2007) [1.0.2.000071]
018: */package org.jamwiki.utils;
019:
020: import java.util.Properties;
021: import junit.framework.TestCase;
022:
023: /**
024: *
025: */
026: public class EncryptionTest extends TestCase {
027:
028: /**
029: *
030: */
031: public void testDecrypt64() throws Throwable {
032: String result = Encryption.decrypt64("");
033: assertEquals("result", "", result);
034: }
035:
036: /**
037: *
038: */
039: public void testDecrypt641() throws Throwable {
040: String result = Encryption.decrypt64(null);
041: assertNull("result", result);
042: }
043:
044: /**
045: *
046: */
047: public void testEncrypt64() throws Throwable {
048: String result = Encryption.encrypt64((String) null);
049: assertNull("result", result);
050: }
051:
052: /**
053: *
054: */
055: public void testEncrypt641() throws Throwable {
056: String result = Encryption.encrypt64("");
057: assertEquals("result", "", result);
058: }
059:
060: /**
061: *
062: */
063: public void testGetEncryptedProperty() throws Throwable {
064: Encryption.getEncryptedProperty("", null);
065: assertTrue("Test completed without Exception", true);
066: // dependencies on static and environment state led to removal of 1 assertion(s)
067: }
068:
069: /**
070: *
071: */
072: public void testGetEncryptedProperty1() throws Throwable {
073: Properties props = new SortedProperties();
074: props.put("", "");
075: String result = Encryption.getEncryptedProperty("", props);
076: assertSame("result", "", result);
077: }
078:
079: /**
080: *
081: */
082: public void testGetEncryptedProperty2() throws Throwable {
083: String result = Encryption.getEncryptedProperty(
084: "testEncryptionName", new Properties());
085: assertNull("result", result);
086: }
087:
088: /**
089: *
090: */
091: public void testSetEncryptedProperty() throws Throwable {
092: Encryption.setEncryptedProperty("testEncryptionName", "", null);
093: assertTrue("Test completed without Exception", true);
094: }
095:
096: /**
097: *
098: */
099: public void testSetEncryptedProperty1() throws Throwable {
100: Encryption.setEncryptedProperty("testEncryptionName", null,
101: null);
102: assertTrue("Test completed without Exception", true);
103: }
104:
105: /**
106: *
107: */
108: public void testSetEncryptedProperty2() throws Throwable {
109: Properties props = new Properties();
110: Encryption
111: .setEncryptedProperty("testEncryptionName", "", props);
112: assertEquals("props.size()", 1, props.size());
113: assertEquals("props.get(\"testEncryptionName\")", "", props
114: .get("testEncryptionName"));
115: }
116:
117: /**
118: *
119: */
120: public void testSetEncryptedProperty3() throws Throwable {
121: Properties props = new SortedProperties();
122: Encryption.setEncryptedProperty("testEncryptionName", null,
123: props);
124: assertEquals("(SortedProperties) props.size()", 1, props.size());
125: assertEquals(
126: "(SortedProperties) props.get(\"testEncryptionName\")",
127: "", props.get("testEncryptionName"));
128: }
129:
130: /**
131: *
132: */
133: public void testEncrypt64ThrowsNullPointerException()
134: throws Throwable {
135: try {
136: Encryption.encrypt64((byte[]) null);
137: fail("Expected NullPointerException to be thrown");
138: } catch (NullPointerException ex) {
139: // FIXME - do something here
140: }
141: }
142:
143: /**
144: *
145: */
146: public void testEncryptThrowsNullPointerException()
147: throws Throwable {
148: try {
149: Encryption.encrypt(null);
150: fail("Expected NullPointerException to be thrown");
151: } catch (NullPointerException ex) {
152: // FIXME - do something here
153: }
154: }
155: }
|