Create test classes
This commit is contained in:
parent
8f99163df7
commit
a1732d99a7
@ -0,0 +1,30 @@
|
|||||||
|
package com.baeldung.properties.yamllist;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.baeldung.properties.yamllist.pojo.ApplicationProps;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
class YamlComplexListsIntegrationTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationProps applicationProps;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenYamlNestedLists_thenLoadComplexLists() {
|
||||||
|
assertThat(applicationProps.getUsers()
|
||||||
|
.get(0)
|
||||||
|
.getPassword()).isEqualTo("admin@10@");
|
||||||
|
assertThat(applicationProps.getTeam()
|
||||||
|
.get(0)
|
||||||
|
.size()).isEqualTo(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.baeldung.properties.yamllist;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.baeldung.properties.yamllist.pojo.ApplicationProps;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
class YamlSimpleListIntegrationTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationProps applicationProps;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenYamlList_thenLoadSimpleList() {
|
||||||
|
assertThat(applicationProps.getProfiles()
|
||||||
|
.get(0)).isEqualTo("dev");
|
||||||
|
assertThat(applicationProps.getProfiles()
|
||||||
|
.get(4)
|
||||||
|
.getClass()
|
||||||
|
.toString()).isEqualTo("class java.lang.Integer");
|
||||||
|
assertThat(applicationProps.getProfiles()
|
||||||
|
.size()).isEqualTo(5);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user