From 014f80c5af3f31d5baca9182576f63d0bebfa368 Mon Sep 17 00:00:00 2001 From: lapentafd Date: Thu, 8 Dec 2022 12:12:10 +0000 Subject: Clamp models code coverage Issue-ID: POLICY-4476 Change-Id: Ie34f278cf999dd2046ccdff6b97936b42ad19355 Signed-off-by: lapentafd --- .../provider/AcDefinitionProviderTest.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'models/src') diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java index a2d6d69c2..50953d692 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java @@ -22,6 +22,7 @@ package org.onap.policy.clamp.models.acm.persistence.provider; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -46,6 +47,8 @@ import org.springframework.data.domain.Example; class AcDefinitionProviderTest { private static final String TOSCA_SERVICE_TEMPLATE_YAML = "clamp/acm/pmsh/funtional-pmsh-usecase.yaml"; + private static final String TOSCA_SERVICE_TEMPLATE_YAML_PROP = + "clamp/acm/test/tosca-template-additional-properties.yaml"; private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder(); @@ -56,6 +59,24 @@ class AcDefinitionProviderTest { inputServiceTemplate = getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); } + @Test + void testDocCopyCompare() { + + var inputServiceTemplateProperties = getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML_PROP); + var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplateProperties); + var docServiceTemplateCopy = new DocToscaServiceTemplate(docServiceTemplate); + + assertTrue(docServiceTemplate.compareTo(docServiceTemplateCopy) < -1); + assertThat(docServiceTemplate.compareToWithoutEntities(docServiceTemplateCopy)).isZero(); + + var acmDefinition = getAcDefinition(docServiceTemplate); + var acmDefinitionCopy = getAcDefinition(docServiceTemplateCopy); + + assertThat(acmDefinition.getServiceTemplate().getName()).isEqualTo( + acmDefinitionCopy.getServiceTemplate().getName()); + + } + @Test void testCreateServiceTemplate() { var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplate); -- cgit 1.2.3-korg