diff --git a/spring-boot-samples/pom.xml b/spring-boot-samples/pom.xml index 7c2b0778494b..b555b92df08a 100644 --- a/spring-boot-samples/pom.xml +++ b/spring-boot-samples/pom.xml @@ -57,6 +57,7 @@ spring-boot-sample-jta-bitronix spring-boot-sample-jta-jndi spring-boot-sample-junit-jupiter + spring-boot-sample-junit-vintage spring-boot-sample-kafka spring-boot-sample-liquibase spring-boot-sample-logback diff --git a/spring-boot-samples/spring-boot-sample-junit-vintage/pom.xml b/spring-boot-samples/spring-boot-sample-junit-vintage/pom.xml new file mode 100644 index 000000000000..0b5b2f1ddca1 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-junit-vintage/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-samples + ${revision} + + spring-boot-sample-junit-vintage + Spring Boot JUnit Vintage Sample + Spring Boot JUnit Vintage Sample + + ${basedir}/../.. + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.jupiter + junit-jupiter + + + org.mockito + mockito-junit-jupiter + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + + diff --git a/spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/MessageController.java b/spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/MessageController.java new file mode 100644 index 000000000000..e9afd39306ef --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/MessageController.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class MessageController { + + @GetMapping("/hi") + public String hello() { + return "Hello World"; + } + +} diff --git a/spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/SampleJunitVintageApplication.java b/spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/SampleJunitVintageApplication.java new file mode 100644 index 000000000000..f5385c4eb02f --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/SampleJunitVintageApplication.java @@ -0,0 +1,29 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SampleJunitVintageApplication { + + public static void main(String[] args) { + SpringApplication.run(SampleJunitVintageApplication.class, args); + } + +} diff --git a/spring-boot-samples/spring-boot-sample-junit-vintage/src/test/java/sample/SampleJunitVintageApplicationTests.java b/spring-boot-samples/spring-boot-sample-junit-vintage/src/test/java/sample/SampleJunitVintageApplicationTests.java new file mode 100644 index 000000000000..3bba75a8a407 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-junit-vintage/src/test/java/sample/SampleJunitVintageApplicationTests.java @@ -0,0 +1,43 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample; + +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.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class SampleJunitVintageApplicationTests { + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void testMessage() { + String message = this.restTemplate.getForObject("/hi", String.class); + assertThat(message).isEqualTo("Hello World"); + } + +} diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index b09c33e376a7..d06f28b1c6ff 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -45,4 +45,5 @@ +