Added sample code for BAEL-1122 (#6468)
This commit is contained in:
committed by
KevinGilmore
parent
2c4d334dc3
commit
8f54420e95
+25
@@ -0,0 +1,25 @@
|
||||
package org.baeldung.properties.multiple;
|
||||
|
||||
import org.baeldung.properties.spring.PropertiesWithJavaConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringJUnitConfig(PropertiesWithJavaConfig.class)
|
||||
public class MultiplePropertiesJavaConfigIntegrationTest {
|
||||
|
||||
@Value("${key.something}")
|
||||
private String something;
|
||||
|
||||
@Value("${key.something2}")
|
||||
private String something2;
|
||||
|
||||
|
||||
@Test
|
||||
public void whenReadInjectedValues_thenGetCorrectValues() {
|
||||
assertThat(something).isEqualTo("val");
|
||||
assertThat(something2).isEqualTo("val2");
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package org.baeldung.properties.multiple;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringJUnitConfig(locations = "classpath:configForProperties.xml")
|
||||
public class MultiplePropertiesXmlConfigIntegrationTest {
|
||||
|
||||
@Value("${key.something}") private String something;
|
||||
|
||||
@Value("${key.something2}") private String something2;
|
||||
|
||||
@Test
|
||||
public void whenReadInjectedValues_thenGetCorrectValues() {
|
||||
assertThat(something).isEqualTo("val");
|
||||
assertThat(something2).isEqualTo("val2");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user