diff options
Diffstat (limited to 'vid-automation/src/test/java')
-rw-r--r-- | vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java index b7c6e0e46..6b5b08e2b 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java @@ -43,6 +43,7 @@ import static org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPo import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNull; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; import static vid.automation.test.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS; @@ -771,6 +772,33 @@ public class AaiApiTest extends BaseApiAaiTest { response.getBody()); } + @Test + public void getNewestModelVersionByInvariant() throws JsonProcessingException { + String invariantId = "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"; + + SimulatorApi.registerExpectationFromPreset(new PresetAAIModelVersionsByInvariantId(), CLEAR_THEN_SET ); + + String url = uri + + "/aai_get_newest_model_version_by_invariant/" + invariantId; + ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); + + assertTrue(response.toString().contains("the-newest-version")); + } + + @Test + public void getNewestModelVersionByInvariant_modelNotExist_thenEmptyResponse() { + String invariantId = "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"; + + SimulatorApi.registerExpectationFromPreset(new PresetAAIModelVersionsByInvariantId(), CLEAR_THEN_SET ); + + String url = uri + + "/aai_get_newest_model_version_by_invariant/" + "model-not-exist"; + ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); + + assertTrue(response.getStatusCode().is2xxSuccessful()); + assertNull(response.getBody()); + } + private void assertResponse(Object expected, String response) { assertResponse(Configuration.empty(), expected, response); } |