diff --git a/spring-boot-samples/pom.xml b/spring-boot-samples/pom.xml index 7c2b077849..b555b92df0 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 0000000000..d245eb7bfa --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-junit-vintage/pom.xml @@ -0,0 +1,28 @@ + + + 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 + + + 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 0000000000..f46482e8e4 --- /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 +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 0000000000..f5385c4eb0 --- /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 0000000000..3f23fc5185 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-junit-vintage/src/test/java/sample/SampleJunitVintageApplicationTests.java @@ -0,0 +1,42 @@ +/* + * 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.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; + +@RunWith(SpringRunner.class) +@WebMvcTest +public class SampleJunitVintageApplicationTests { + + @Autowired + private MockMvc mockMvc; + + @Test + public void testMessage() throws Exception { + this.mockMvc.perform(get("/hi")).andExpect(content().string("Hello World")); + } + +} diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index 6fe7519938..4ff7999a78 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -44,4 +44,5 @@ +