-
-
Save jwalgemoed/1cb523fea9cb91d245ede6565f3f8cb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringRunner::class) | |
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
class DslDemoApplicationTests { | |
@Autowired | |
private lateinit var testRestTemplate: TestRestTemplate | |
@Test | |
fun `Test 'Hello' endpoint using a valid name`() { | |
val headers = HttpHeaders() | |
headers.put("Accept", listOf("application/json")) | |
val entity = HttpEntity<Any>(headers) | |
val response = testRestTemplate.exchange( | |
"/api/hello/Jarno", HttpMethod.GET, entity, String::class.java) | |
assertEquals(HttpStatus.OK, response.statusCode) | |
assertJsonEquals("{ \"message\": \"Hi, Jarno!\" }", response.body) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment