From a029b8b76a2a2d028f8a97f6a6884d90ebfd3fbc Mon Sep 17 00:00:00 2001 From: biniek Date: Tue, 19 Dec 2017 11:57:06 +0100 Subject: Cleanup of utils classes. Removed javadoc without any information; enforced util class won't be initialized; extracted constants. Change-Id: Ie30156472d929dfc95819a1d5affaaf867eed611 Issue-ID: CLAMP-96 Signed-off-by: biniek --- .../org/onap/clamp/clds/util/CryptoUtilsTest.java | 39 +++++----------------- 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'src/test/java/org/onap') diff --git a/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java b/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java index 6fe447556..c6aafcd8c 100644 --- a/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java +++ b/src/test/java/org/onap/clamp/clds/util/CryptoUtilsTest.java @@ -27,47 +27,26 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import java.io.UnsupportedEncodingException; -import java.security.GeneralSecurityException; - -import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; -/** - * Test Crypto Utils with Spring. - */ + public class CryptoUtilsTest { - private CryptoUtils cryptoUtils = new CryptoUtils(); - final String data = "This is a test string"; - /** - * This method tests encryption. - * - * @throws GeneralSecurityException - * @throws DecoderException - * @throws UnsupportedEncodingException - */ + private final String data = "This is a test string"; + @Test - public final void testEncryption() throws GeneralSecurityException, DecoderException, UnsupportedEncodingException { - String encodedString = cryptoUtils.encrypt(data); + public final void testEncryption() throws Exception { + String encodedString = CryptoUtils.encrypt(data); assertNotNull(encodedString); - assertEquals(data, cryptoUtils.decrypt(encodedString)); + assertEquals(data, CryptoUtils.decrypt(encodedString)); } - /** - * This method tests encryption. - * - * @throws GeneralSecurityException - * @throws DecoderException - * @throws UnsupportedEncodingException - */ @Test - public final void testEncryptedStringIsDifferent() - throws GeneralSecurityException, DecoderException, UnsupportedEncodingException { - String encodedString1 = cryptoUtils.encrypt(data); - String encodedString2 = cryptoUtils.encrypt(data); + public final void testEncryptedStringIsDifferent() throws Exception { + String encodedString1 = CryptoUtils.encrypt(data); + String encodedString2 = CryptoUtils.encrypt(data); byte[] encryptedMessage1 = Hex.decodeHex(encodedString1.toCharArray()); byte[] encryptedMessage2 = Hex.decodeHex(encodedString2.toCharArray()); assertNotNull(encryptedMessage1); -- cgit 1.2.3-korg