diff --git a/test/fr/devinsy/sikevadb/SQLSikevaDBTest.java b/test/fr/devinsy/sikevadb/SQLSikevaDBTest.java index a36c481..0a9e61f 100644 --- a/test/fr/devinsy/sikevadb/SQLSikevaDBTest.java +++ b/test/fr/devinsy/sikevadb/SQLSikevaDBTest.java @@ -5,6 +5,8 @@ import java.util.Date; 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.Level; import org.apache.log4j.Logger; @@ -376,6 +378,31 @@ public class SQLSikevaDBTest { 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 *