Add Base64 test.

This commit is contained in:
Christian P. MOMON 2013-09-06 02:02:03 +02:00
parent 38c415f670
commit a9ebc14796

View file

@ -5,6 +5,8 @@ import java.util.Date;
import javax.naming.NamingException; import javax.naming.NamingException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -376,6 +378,31 @@ public class SQLSikevaDBTest {
logger.debug("===== test done."); logger.debug("===== test done.");
} }
/**
* @throws Exception
*
*/
@Test
public void testRandom01() throws Exception {
//
logger.debug("===== test starting...");
database.clearDatabase();
String surSource = RandomStringUtils.random(128);
String source = org.apache.commons.codec.binary.Base64.encodeBase64String(surSource.getBytes());
database.put("alpha01", null, source);
String target = database.getValue("alpha01");
Assert.assertEquals(source, target);
String surTarget = new String(Base64.decodeBase64(target));
Assert.assertEquals(surSource, surTarget);
//
logger.debug("===== test done.");
}
/** /**
* @throws Exception * @throws Exception
* *