BAEL-20869 Move remaining spring boot modules

This commit is contained in:
mikr
2020-02-02 20:44:54 +01:00
parent 3e26f588fc
commit 06161e1bae
704 changed files with 1303 additions and 1501 deletions
@@ -0,0 +1,27 @@
package com.baeldung.jasypt;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.jasypt.Main;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {Main.class})
public class CustomJasyptIntegrationTest {
@Autowired
ApplicationContext appCtx;
@Test
public void whenConfiguredExcryptorUsed_ReturnCustomEncryptor() {
Environment environment = appCtx.getBean(Environment.class);
assertEquals("Password@3", environment.getProperty("encryptedv3.property"));
}
}
@@ -0,0 +1,28 @@
package com.baeldung.jasypt;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.jasypt.simple.PropertyServiceForJasyptSimple;
@RunWith(SpringRunner.class)
@SpringBootTest
public class JasyptSimpleIntegrationTest {
@Autowired
ApplicationContext appCtx;
@Test
public void whenDecryptedPasswordNeeded_GetFromService() {
System.setProperty("jasypt.encryptor.password", "password");
PropertyServiceForJasyptSimple service = appCtx.getBean(PropertyServiceForJasyptSimple.class);
assertEquals("Password@2", service.getProperty());
}
}
@@ -0,0 +1,30 @@
package com.baeldung.jasypt;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.jasypt.starter.PropertyServiceForJasyptStarter;
@RunWith(SpringRunner.class)
@SpringBootTest
public class JasyptWithStarterIntegrationTest {
@Autowired
ApplicationContext appCtx;
@Test
public void whenDecryptedPasswordNeeded_GetFromService() {
System.setProperty("jasypt.encryptor.password", "password");
PropertyServiceForJasyptStarter service = appCtx.getBean(PropertyServiceForJasyptStarter.class);
assertEquals("Password@1", service.getProperty());
Environment environment = appCtx.getBean(Environment.class);
assertEquals("Password@1", service.getPasswordUsingEnvironment(environment));
}
}
@@ -0,0 +1,17 @@
package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.jasypt.Main;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Main.class)
public class SpringContextTest {
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
}
}