diff options
author | 2019-03-26 22:31:43 +0000 | |
---|---|---|
committer | 2019-03-26 22:31:43 +0000 | |
commit | cee84a9344f35356f86384b0d48127f5a83e3776 (patch) | |
tree | c2a796218273fa4553f07d1328adac3882ab4711 /models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java | |
parent | 38e3ea9ff6a0a1534a30655e22082cf4c8d887d0 (diff) |
Add Legacy Op Policy Persistence
Legacy operational policies now fully supported for
serialization and persistence from provider through to
database and back. Unit test coverage completed
also
Issue-ID: POLICY-1095
Change-Id: I65755859c94b50edee537d2685f51a7838c6541f
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java')
-rw-r--r-- | models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java index c5dd8f03d..e4ecb9d1d 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java @@ -316,10 +316,30 @@ public class DatabasePolicyModelsProviderTest { assertEquals("policy not found: NULL:0.0.0", npe.getMessage()); } - assertNull(databaseProvider.getOperationalPolicy("policy_id")); - assertNull(databaseProvider.createOperationalPolicy(new LegacyOperationalPolicy())); - assertNull(databaseProvider.updateOperationalPolicy(new LegacyOperationalPolicy())); - assertNull(databaseProvider.deleteOperationalPolicy("policy_id")); + try { + assertNull(databaseProvider.getOperationalPolicy("policy_id")); + fail("test should throw an exception"); + } catch (Exception npe) { + assertEquals("no policy found for policy ID: policy_id", npe.getMessage()); + } + try { + assertNull(databaseProvider.createOperationalPolicy(new LegacyOperationalPolicy())); + fail("test should throw an exception"); + } catch (Exception npe) { + assertEquals("name is marked @NonNull but is null", npe.getMessage()); + } + try { + assertNull(databaseProvider.updateOperationalPolicy(new LegacyOperationalPolicy())); + fail("test should throw an exception"); + } catch (Exception npe) { + assertEquals("no policy found for policy ID: null", npe.getMessage()); + } + try { + assertNull(databaseProvider.deleteOperationalPolicy("policy_id")); + fail("test should throw an exception"); + } catch (Exception npe) { + assertEquals("no policy found for policy ID: policy_id", npe.getMessage()); + } assertNull(databaseProvider.getGuardPolicy("policy_id")); assertNull(databaseProvider.createGuardPolicy(new LegacyGuardPolicy())); |