From 3ca2b3ce1676cb526dedc3a7529f282bb5dd3e2a Mon Sep 17 00:00:00 2001 From: Marco Denisi Date: Sun, 28 Jun 2020 10:15:48 +0200 Subject: [PATCH] BAEL-4083 - add app integration test --- spring-boot-modules/spring-boot-xml/pom.xml | 8 ++++++ ...ringBootXmlApplicationIntegrationTest.java | 26 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-xml/pom.xml b/spring-boot-modules/spring-boot-xml/pom.xml index dd575ff414..e1ddd8f437 100644 --- a/spring-boot-modules/spring-boot-xml/pom.xml +++ b/spring-boot-modules/spring-boot-xml/pom.xml @@ -18,6 +18,14 @@ org.springframework.boot spring-boot-starter + + org.springframework.boot + spring-boot-starter-test + + + junit + junit + diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java new file mode 100644 index 0000000000..2c3993d0d8 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.springbootxml; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootXmlApplication.class) +public class SpringBootXmlApplicationIntegrationTest { + + @Autowired private Pojo pojo; + @Value("${sample}") private String sample; + + @Test + public void whenCallingGetter_thenPrintingProperty() { + assertThat(pojo.getField()) + .isNotBlank() + .isEqualTo(sample); + } + +} \ No newline at end of file