mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 05:32:58 +08:00
Improve media type assertion
Instead of doing a strict equality between the expected media type and the one received in the response, we use isCompatibleWith that ensure that at least the expected capabilities are present.
This commit is contained in:
@@ -133,14 +133,14 @@ class MainControllerIntegrationTests extends AbstractInitializrControllerIntegra
|
||||
@Test
|
||||
void metadataWithNoAcceptHeader() { // rest template sets application/json by default
|
||||
ResponseEntity<String> response = getMetadata(null, '*/*')
|
||||
assertEquals CURRENT_METADATA_MEDIA_TYPE, response.getHeaders().getContentType()
|
||||
assertTrue response.headers.getContentType().isCompatibleWith(CURRENT_METADATA_MEDIA_TYPE)
|
||||
validateCurrentMetadata(new JSONObject(response.body))
|
||||
}
|
||||
|
||||
@Test
|
||||
void metadataWithCurrentAcceptHeader() {
|
||||
ResponseEntity<String> response = getMetadata(null, 'application/vnd.initializr.v2+json')
|
||||
assertEquals CURRENT_METADATA_MEDIA_TYPE, response.getHeaders().getContentType()
|
||||
assertTrue response.headers.getContentType().isCompatibleWith(CURRENT_METADATA_MEDIA_TYPE)
|
||||
validateCurrentMetadata(new JSONObject(response.body))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user