diff options
Diffstat (limited to 'model/context-model')
2 files changed, 8 insertions, 17 deletions
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java index 0406543fb..74b000ff3 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextAlbumsTest.java @@ -21,11 +21,11 @@ package org.onap.policy.apex.model.contextmodel.concepts; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -57,13 +57,9 @@ public class ContextAlbumsTest { assertEquals("NewAlbumName:0.0.1", album.getKeys().get(0).getId()); album.setKey(albumKey); - try { - album.setScope(""); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertEquals("parameter \"scope\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"", - e.getMessage()); - } + assertThatThrownBy(() -> album.setScope("")) + .hasMessage("parameter \"scope\": value \"\", does not match regular expression " + + "\"[A-Za-z0-9\\-_]+\""); album.setScope("NewAlbumScope"); assertEquals("NewAlbumScope", album.getScope()); diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java index e5fc19a20..abe7c008f 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextSchemasTest.java @@ -21,11 +21,11 @@ package org.onap.policy.apex.model.contextmodel.concepts; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -51,14 +51,9 @@ public class ContextSchemasTest { assertEquals("NewSchemaName:0.0.1", schema.getKey().getId()); assertEquals("NewSchemaName:0.0.1", schema.getKeys().get(0).getId()); - try { - schema.setSchemaFlavour(""); - fail("test should throw an exception here"); - } catch (final Exception e) { - assertEquals("parameter \"schemaFlavour\": value \"\", " - + "does not match regular expression \"[A-Za-z0-9\\-_]+\"", e.getMessage()); - } - + assertThatThrownBy(() -> schema.setSchemaFlavour("")) + .hasMessage("parameter \"schemaFlavour\": value \"\", " + + "does not match regular expression \"[A-Za-z0-9\\-_]+\""); schema.setSchemaFlavour("NewSchemaFlavour"); assertEquals("NewSchemaFlavour", schema.getSchemaFlavour()); |