Skip to content
Snippets Groups Projects
Commit 367f62ee authored by Torbjørn Antonsen's avatar Torbjørn Antonsen
Browse files

Removed unnecessary files created at project initialization

parent 5b898383
No related branches found
No related tags found
1 merge request!19Removed unnecessary files created at project initialization
Pipeline #268451 passed
package edu.ntnu.idatt2105.controller;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HelloController {
@RequestMapping("/")
public ResponseEntity<String> helloWorld(){
return new ResponseEntity<>("Hello", HttpStatus.OK);
}
}
\ No newline at end of file
package edu.ntnu.idatt2105;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalServerPort;
import static org.junit.jupiter.api.Assertions.assertEquals;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CheckHTTPResponse {
@LocalServerPort
private int port;
@Autowired
private TestRestTemplate testRestTemplate;
@Test
public void shouldPassIfStringMatches(){
assertEquals("Hello World from Spring Boot",
testRestTemplate.getForObject("http://localhost:" + port + "/",
String.class));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment