Initialized from 'Spring' project template

Template repository: https://gitlab.com/gitlab-org/project-templates/spring
Commit SHA: c56244810044bdfac15f54cbedaf23f7185c4a27
This commit is contained in:
GitLab
2023-11-02 17:47:41 +01:00
committed by Achilleas Pipinellis
commit 0934f0e598
14 changed files with 631 additions and 0 deletions
@@ -0,0 +1,21 @@
package com.example.demo;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.web.bind.annotation.*;
@SpringBootApplication
@RestController
public class DemoApplication {
//test
@GetMapping("/")
public String home() {
return "Spring is here!";
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@@ -0,0 +1,25 @@
package com.example.demo;
import org.junit.jupiter.api.Test;
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 static org.junit.jupiter.api.Assertions.assertEquals;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class DemoApplicationTests {
@Test
void contextLoads() {
}
@Autowired
private TestRestTemplate restTemplate;
@Test
void homeResponse() {
String body = this.restTemplate.getForObject("/", String.class);
assertEquals("Spring is here!", body);
}
}