Fix test names (#1853)

* upgrade to spring boot 1.5.2

* add full update to REST API

* modify ratings controller

* upgrade herold

* fix integration test

* fix integration test

* minor fix

* fix integration test

* fix integration test

* minor cleanup

* minor cleanup

* remove log4j properties

* use standard logbook.xml

* remove log4j dependencies

* remove commons-logging

* merge

* fix conflict

* exclude commons-logging dependency

* cleanup

* minor fix

* minor fix

* fix dependency issues

* Revert "fix dependency issues"

This reverts commit 83bf1f9fd2e1a9a55f9cacb085669568b06b49ec.

* fix dependency issues

* minor fix

* minor fix

* minor fix

* cleanup generated files

* fix commons-logging issue

* add parent to pom

* cleanup parent dependencies

* cleanup pom

* cleanup pom

* add missing parent

* fix logging issue

* fix test names
This commit is contained in:
Doha2012
2017-05-15 18:35:14 +02:00
committed by Eugen
parent 5a58aacb8f
commit 48cd6f876f
369 changed files with 405 additions and 405 deletions
@@ -0,0 +1,96 @@
package com.baeldung.jasypt;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.util.password.BasicPasswordEncryptor;
import org.jasypt.util.text.BasicTextEncryptor;
import org.junit.Ignore;
import org.junit.Test;
import static junit.framework.Assert.*;
import static junit.framework.TestCase.assertEquals;
public class JasyptUnitTest {
@Test
public void givenTextPrivateData_whenDecrypt_thenCompareToEncrypted() {
//given
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
String privateData = "secret-data";
textEncryptor.setPasswordCharArray("some-random-data".toCharArray());
//when
String myEncryptedText = textEncryptor.encrypt(privateData);
assertNotSame(privateData, myEncryptedText); //myEncryptedText can be save in db
//then
String plainText = textEncryptor.decrypt(myEncryptedText);
assertEquals(plainText, privateData);
}
@Test
public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldBeSame(){
String password = "secret-pass";
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
String encryptedPassword = passwordEncryptor.encryptPassword(password);
//when
boolean result = passwordEncryptor.checkPassword("secret-pass", encryptedPassword);
//then
assertTrue(result);
}
@Test
public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldNotBeSame(){
String password = "secret-pass";
BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
String encryptedPassword = passwordEncryptor.encryptPassword(password);
//when
boolean result = passwordEncryptor.checkPassword("secret-pass-not-same", encryptedPassword);
//then
assertFalse(result);
}
@Test
@Ignore("should have installed local_policy.jar")
public void givenTextPrivateData_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() {
//given
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
String privateData = "secret-data";
encryptor.setPassword("some-random-data");
encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
//when
String encryptedText = encryptor.encrypt("secret-pass");
assertNotSame(privateData, encryptedText);
//then
String plainText = encryptor.decrypt(encryptedText);
assertEquals(plainText, privateData);
}
@Test
@Ignore("should have installed local_policy.jar")
public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt(){
//given
String privateData = "secret-data";
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
encryptor.setPoolSize(4);
encryptor.setPassword("some-random-data");
encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
//when
String encryptedText = encryptor.encrypt(privateData);
assertNotSame(privateData, encryptedText);
//then
String plainText = encryptor.decrypt(encryptedText);
assertEquals(plainText, privateData);
}
}