X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-tosca%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Ftosca%2Fauthorative%2Fprovider%2FAuthorativeToscaProviderPolicyTypeTest.java;h=42ac1272f14f9acbb56cca953900108a28ca6324;hb=389c85c8e7213c10c17896f4c63d94e2b5e9d27a;hp=d77b52daa06bba59ef5e705e430544ff7c99f547;hpb=b0e460abe43d40528da4856f2f3d5ee162ac1830;p=policy%2Fmodels.git diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java index d77b52daa..42ac1272f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021, 2023-2024 Nordix Foundation. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Properties; import org.apache.commons.lang3.ObjectUtils; -import org.eclipse.persistence.config.PersistenceUnitProperties; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -43,29 +42,26 @@ import org.onap.policy.models.dao.DaoParameters; import org.onap.policy.models.dao.PfDao; import org.onap.policy.models.dao.PfDaoFactory; import org.onap.policy.models.dao.impl.DefaultPfDao; +import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate; import org.yaml.snakeyaml.Yaml; /** * Test of the {@link AuthorativeToscaProvider} class. - * - * @author Liam Fallon (liam.fallon@est.tech) */ public class AuthorativeToscaProviderPolicyTypeTest { private static final String VERSION = "version"; - private static final String POLICY_AFFINITY_VERSION0 = "onap.policies.optimization.AffinityPolicy:0.0.0"; - private static final String POLICY_AFFINITY = "onap.policies.optimization.AffinityPolicy"; + private static final String POLICY_NO_VERSION_VERSION1 = "onap.policies.NoVersion:0.0.1"; + private static final String POLICY_NO_VERSION = "onap.policies.NoVersion"; private static final String MISSING_POLICY_TYPES = "no policy types specified on service template"; - private static final String DAO_IS_NULL = "dao is marked @NonNull but is null"; - private static final String VERSION_000 = "0.0.0"; + private static final String DAO_IS_NULL = "^dao is marked .*on.*ull but is null$"; + private static final String VERSION_001 = "0.0.1"; private static String yamlAsJsonString; private PfDao pfDao; private StandardCoder standardCoder; - /** * Read the policy type definition. * @@ -73,8 +69,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { */ @BeforeClass public static void readPolicyDefinition() { - String yamlString = - ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.AffinityPolicy.yaml"); + String yamlString = ResourceUtils.getResourceAsString("src/test/resources/onap.policies.NoVersion.yaml"); Object yamlObject = new Yaml().load(yamlString); yamlAsJsonString = new GsonBuilder().setPrettyPrinting().create().toJson(yamlObject); @@ -93,14 +88,17 @@ public class AuthorativeToscaProviderPolicyTypeTest { daoParameters.setPersistenceUnit("ToscaConceptTest"); Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy"); - jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY"); - - // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB - jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); - jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb"); - - daoParameters.setJdbcProperties(jdbcProperties ); + jdbcProperties.setProperty("jakarta.persistence.jdbc.user", "policy"); + jdbcProperties.setProperty("jakarta.persistence.jdbc.password", "P01icY"); + if (System.getProperty("USE-MARIADB") != null) { + jdbcProperties.setProperty("jakarta.persistence.jdbc.driver", "org.mariadb.jdbc.Driver"); + jdbcProperties.setProperty("jakarta.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/policy"); + } else { + jdbcProperties.setProperty("jakarta.persistence.jdbc.driver", "org.h2.Driver"); + jdbcProperties.setProperty("jakarta.persistence.jdbc.url", + "jdbc:h2:mem:AuthorativeToscaProviderPolicyTypeTest"); + } + daoParameters.setJdbcProperties(jdbcProperties); pfDao = new PfDaoFactory().createPfDao(daoParameters); pfDao.init(daoParameters); @@ -123,11 +121,11 @@ public class AuthorativeToscaProviderPolicyTypeTest { public void testPolicyTypesGet() throws Exception { assertThatThrownBy(() -> { new AuthorativeToscaProvider().getPolicyTypes(null, null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().getPolicyList(null, null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class); @@ -135,7 +133,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { ToscaServiceTemplate createdServiceTemplate = new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplate); - PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); + PfConceptKey policyTypeKey = new PfConceptKey(POLICY_NO_VERSION_VERSION1); ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); @@ -149,51 +147,63 @@ public class AuthorativeToscaProviderPolicyTypeTest { assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); - List gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, - POLICY_AFFINITY, VERSION_000); - assertEquals(1, gotPolicyTypeList.size()); + List gotPolicyTypeList = + new AuthorativeToscaProvider().getPolicyTypeList(pfDao, POLICY_NO_VERSION, VERSION_001); + assertEquals(2, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, - POLICY_AFFINITY, null); - assertEquals(1, gotPolicyTypeList.size()); + gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, POLICY_NO_VERSION, null); + assertEquals(2, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, null, null); - assertEquals(1, gotPolicyTypeList.size()); + assertEquals(2, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, null, VERSION_000); - assertEquals(1, gotPolicyTypeList.size()); + gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, null, VERSION_001); + assertEquals(2, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - } + assertThatThrownBy(() -> new AuthorativeToscaProvider().getPolicyTypeList(new DefaultPfDao(), POLICY_NO_VERSION, + VERSION_001)).hasMessageContaining("Policy Framework DAO has not been initialized"); + + assertTrue(new AuthorativeToscaProvider().getPolicyTypeList(pfDao, "i.dont.Exist", VERSION_001).isEmpty()); + } @Test public void testPolicyTypesGetFiltered() throws Exception { assertThatThrownBy(() -> { new AuthorativeToscaProvider().getFilteredPolicyTypes(null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { - new AuthorativeToscaProvider().getFilteredPolicyTypes(null, ToscaPolicyTypeFilter.builder().build()); - }).hasMessage(DAO_IS_NULL); + new AuthorativeToscaProvider().getFilteredPolicyTypes(null, + ToscaEntityFilter.builder().build()); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, null); - }).hasMessage("filter is marked @NonNull but is null"); + }).hasMessageMatching("^filter is marked .*on.*ull but is null$"); assertThatThrownBy(() -> { new AuthorativeToscaProvider().getFilteredPolicyTypeList(null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { - new AuthorativeToscaProvider().getFilteredPolicyTypeList(null, ToscaPolicyTypeFilter.builder().build()); - }).hasMessage(DAO_IS_NULL); + new AuthorativeToscaProvider().getFilteredPolicyTypeList(null, + ToscaEntityFilter.builder().build()); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, null); - }).hasMessage("filter is marked @NonNull but is null"); + }).hasMessageMatching("^filter is marked .*on.*ull but is null$"); + + assertThatThrownBy(() -> new AuthorativeToscaProvider().getFilteredPolicyTypeList(new DefaultPfDao(), + ToscaEntityFilter.builder().name("i.dont.Exist").build())) + .hasMessageContaining("Policy Framework DAO has not been initialized"); + + assertTrue(new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, + ToscaEntityFilter.builder().name("i.dont.Exist").build()).isEmpty()); ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class); @@ -201,73 +211,75 @@ public class AuthorativeToscaProviderPolicyTypeTest { ToscaServiceTemplate createdServiceTemplate = new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplate); - PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); + PfConceptKey policyTypeKey = new PfConceptKey(POLICY_NO_VERSION_VERSION1); ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(createdPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); - ToscaServiceTemplate gotServiceTemplate = - new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, ToscaPolicyTypeFilter.builder().build()); + ToscaServiceTemplate gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, + ToscaEntityFilter.builder().build()); ToscaPolicyType gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); - assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); + checkEqualsNameDescription(beforePolicyType, gotPolicyType); gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, - ToscaPolicyTypeFilter.builder().name(policyTypeKey.getName()).build()); + ToscaEntityFilter.builder().name(policyTypeKey.getName()).build()); gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); - assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); + checkEqualsNameDescription(beforePolicyType, gotPolicyType); - gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, - ToscaPolicyTypeFilter.builder().name(policyTypeKey.getName()).version(VERSION_000).build()); + gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, ToscaEntityFilter + .builder().name(policyTypeKey.getName()).version(VERSION_001).build()); gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); - assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); + checkEqualsNameDescription(beforePolicyType, gotPolicyType); - List gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, - POLICY_AFFINITY, VERSION_000); - assertEquals(1, gotPolicyTypeList.size()); + List gotPolicyTypeList = + new AuthorativeToscaProvider().getPolicyTypeList(pfDao, POLICY_NO_VERSION, VERSION_001); + assertEquals(2, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, - ToscaPolicyTypeFilter.builder().build()); - assertEquals(1, gotPolicyTypeList.size()); + ToscaEntityFilter.builder().build()); + assertEquals(2, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, - ToscaPolicyTypeFilter.builder().name(policyTypeKey.getName()).build()); + ToscaEntityFilter.builder().name(policyTypeKey.getName()).build()); assertEquals(1, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); - gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, - ToscaPolicyTypeFilter.builder().name(policyTypeKey.getName()).version(VERSION_000).build()); + gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, ToscaEntityFilter + .builder().name(policyTypeKey.getName()).version(VERSION_001).build()); assertEquals(1, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, - ToscaPolicyTypeFilter.builder().version("1.0.0").build()); - assertEquals(0, gotPolicyTypeList.size()); + ToscaEntityFilter.builder().version("1.0.0").build()); + assertEquals(1, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); } + private void checkEqualsNameDescription(ToscaPolicyType beforePolicyType, ToscaPolicyType gotPolicyType) { + assertEquals(beforePolicyType.getName(), gotPolicyType.getName()); + assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); + } + @Test public void testPolicyTypesCreate() throws Exception { assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(null, new ToscaServiceTemplate()); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(pfDao, null); - }).hasMessage("serviceTemplate is marked @NonNull but is null"); + }).hasMessageMatching("^serviceTemplate is marked .*on.*ull but is null$"); ToscaServiceTemplate testToscaServiceTemplate = new ToscaServiceTemplate(); assertThatThrownBy(() -> { @@ -285,7 +297,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { ToscaServiceTemplate createdServiceTemplate = new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplate); - PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); + PfConceptKey policyTypeKey = new PfConceptKey(POLICY_NO_VERSION_VERSION1); ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); @@ -297,19 +309,19 @@ public class AuthorativeToscaProviderPolicyTypeTest { public void testPolicyTypesUpdate() throws Exception { assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().updatePolicyTypes(null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().updatePolicyTypes(null, new ToscaServiceTemplate()); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().updatePolicyTypes(pfDao, null); - }).hasMessage("serviceTemplate is marked @NonNull but is null"); + }).hasMessageMatching("^serviceTemplate is marked .*on.*ull but is null$"); ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class); @@ -317,7 +329,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { ToscaServiceTemplate createdServiceTemplate = new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplate); - PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); + PfConceptKey policyTypeKey = new PfConceptKey(POLICY_NO_VERSION_VERSION1); ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); @@ -336,31 +348,31 @@ public class AuthorativeToscaProviderPolicyTypeTest { public void testPolicyTypesDelete() throws Exception { assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(null, null, null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(null, null, VERSION); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(null, "name", null); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(null, "name", VERSION); - }).hasMessage(DAO_IS_NULL); + }).hasMessageMatching(DAO_IS_NULL); assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(pfDao, null, null); - }).hasMessage("name is marked @NonNull but is null"); + }).hasMessageMatching("^name is marked .*on.*ull but is null$"); assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(pfDao, null, VERSION); - }).hasMessage("name is marked @NonNull but is null"); + }).hasMessageMatching("^name is marked .*on.*ull but is null$"); assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(pfDao, "name", null); - }).hasMessage("version is marked @NonNull but is null"); + }).hasMessageMatching("^version is marked .*on.*ull but is null$"); ToscaServiceTemplate toscaServiceTemplate = standardCoder.decode(yamlAsJsonString, ToscaServiceTemplate.class); @@ -368,7 +380,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { ToscaServiceTemplate createdServiceTemplate = new AuthorativeToscaProvider().createPolicyTypes(pfDao, toscaServiceTemplate); - PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); + PfConceptKey policyTypeKey = new PfConceptKey(POLICY_NO_VERSION_VERSION1); ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); @@ -382,10 +394,9 @@ public class AuthorativeToscaProviderPolicyTypeTest { assertEquals(true, beforePolicyType.getName().equals(deletedPolicy.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), deletedPolicy.getDescription())); - ToscaServiceTemplate gotServiceTemplate = new AuthorativeToscaProvider().getPolicyTypes(pfDao, - policyTypeKey.getName(), policyTypeKey.getVersion()); - - assertTrue(gotServiceTemplate.getPolicyTypes().isEmpty()); + assertThatThrownBy(() -> { + new AuthorativeToscaProvider().getPolicyTypes(pfDao, policyTypeKey.getName(), policyTypeKey.getVersion()); + }).hasMessage("policy types for onap.policies.NoVersion:0.0.1 do not exist"); } @Test @@ -394,7 +405,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { assertThatThrownBy(() -> { new AuthorativeToscaProvider().deletePolicyType(pfDao, "name", null); - }).hasMessage("version is marked @NonNull but is null"); + }).hasMessageMatching("^version is marked .*on.*ull but is null$"); assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(pfDao, testServiceTemplate); @@ -410,4 +421,10 @@ public class AuthorativeToscaProviderPolicyTypeTest { new AuthorativeToscaProvider().createPolicyTypes(pfDao, testServiceTemplate); }).hasMessage("An incoming list of concepts must have at least one entry"); } + + @Test + public void testNullParameters() throws Exception { + assertThatThrownBy(() -> new AuthorativeToscaProvider().getPolicyTypeList(null, null, null)) + .hasMessageMatching("^dao is marked .*on.*ull but is null$"); + } }