diff --git a/.gitignore b/.gitignore index 2af7cefb0a3f1e7df2fc27b8421f0e16b460e680..d5dba20660ddd88524bcc9319dec74e445b4d372 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -target/ +/target/ !.mvn/wrapper/maven-wrapper.jar ### STS ### @@ -8,6 +8,7 @@ target/ .project .settings .springBeans +.sts4-cache ### IntelliJ IDEA ### .idea @@ -16,9 +17,9 @@ target/ *.ipr ### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index c315043703752ef4d11cf7d93f2c324852b2ebff..b573bb50d56e8c19282593cbf5b081e211923a83 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/README.md b/README.md index 251c84405556f7e94489ad4ee7825a683c2a8d9d..8a61388d3f4a52a9e6b41944a368433b60346c71 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ ### Java Spring template project -This project is based on a GitLab [Project Template](https://docs.gitlab.com/ee/gitlab-basics/create-project.html) +This project is based on a GitLab [Project Template](https://docs.gitlab.com/ee/gitlab-basics/create-project.html). -Additions and changes to the project can be proposed in the [original project](https://gitlab.com/gitlab-org/project-templates/spring) +Additions and changes to the project can be proposed in the [original project](https://gitlab.com/gitlab-org/project-templates/spring). ### CI/CD with Auto DevOps This template is compatible with [Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/). -If Auto DevOps is not already enabled for this project, you can [turn it on](https://docs.gitlab.com/ee/topics/autodevops/#enabling-auto-devops) -in the project settings. Otherwise, you can create a custom `.gitlab-ci.yml` file and customize it. +If Auto DevOps is not already enabled for this project, you can [turn it on](https://docs.gitlab.com/ee/topics/autodevops/#enabling-auto-devops) in the project settings. +Otherwise, you can create a custom `.gitlab-ci.yml` file and customize it. diff --git a/pom.xml b/pom.xml index 16ab646d5bece6ec6d44b39836d2a29a8471ffaa..2d1e8c87b0f8754dbf72462f119dcea7a92a4b56 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.6.RELEASE + 2.0.1.RELEASE diff --git a/src/test/java/com/example/demo/DemoApplicationTests.java b/src/test/java/com/example/demo/DemoApplicationTests.java index b76e7f2e6a61e5f201d010e65f44039f6a1ea844..8595e84d8724d3586ca52528a6f7067f9c8f5ee6 100644 --- a/src/test/java/com/example/demo/DemoApplicationTests.java +++ b/src/test/java/com/example/demo/DemoApplicationTests.java @@ -3,14 +3,26 @@ package com.example.demo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringRunner; +import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) -@SpringBootTest +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class DemoApplicationTests { @Test public void contextLoads() { } + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void homeResponse() { + String body = this.restTemplate.getForObject("/", String.class); + assertThat(body).isEqualTo("Spring is here!"); + } }