From 09212e0d7326c2933ed437ee36188a241b8cf900 Mon Sep 17 00:00:00 2001 From: waynedunican Date: Fri, 7 Aug 2020 09:51:52 +0100 Subject: SONAR assertion cleanup Replaced assertions to not have the same actual and expected expression in apex-pdp Issue-ID: POLICY-2761 Change-Id: I2bf45a3cc4411bd39f93f9d0b8c8e56dd318281e Signed-off-by: waynedunican --- .../apex/model/contextmodel/concepts/ContextAlbumsTest.java | 9 ++++----- .../apex/model/contextmodel/concepts/ContextModelTest.java | 5 +++-- .../apex/model/contextmodel/concepts/ContextSchemasTest.java | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'model/context-model') 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 74b000ff3..2e2005fcd 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 @@ -115,11 +115,11 @@ public class ContextAlbumsTest { + "AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", clonedAlbum.toString()); assertNotEquals(0, album.hashCode()); - - assertEquals(album, album); + // disabling sonar because this code tests the equals() method + assertEquals(album, album); // NOSONAR assertEquals(album, clonedAlbum); assertNotNull(album); - assertNotEquals(album, (Object) "Hello"); + assertNotEquals(album, "Hello"); assertNotEquals(album, new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey())); assertNotEquals(album, new AxContextAlbum(newKey, "Scope", false, AxArtifactKey.getNullKey())); assertNotEquals(album, new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey())); @@ -183,10 +183,9 @@ public class ContextAlbumsTest { assertNotEquals(0, albums.hashCode()); - assertEquals(albums, albums); assertEquals(albums, clonedAlbums); assertNotNull(albums); - assertNotEquals(albums, (Object) "Hello"); + assertNotEquals(albums, "Hello"); assertNotEquals(albums, new AxContextAlbums(new AxArtifactKey())); assertEquals(0, albums.compareTo(albums)); diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java index 1be226cbd..ae6de38f2 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/ContextModelTest.java @@ -60,9 +60,10 @@ public class ContextModelTest { assertNotEquals(0, model.hashCode()); - assertEquals(model, model); + // disabling sonar because this code tests the equals() method + assertEquals(model, model); // NOSONAR assertEquals(model, clonedModel); - assertNotEquals(model, (Object) "Hello"); + assertNotEquals(model, "Hello"); assertNotEquals(model, new AxContextModel(new AxArtifactKey())); assertNotEquals(model, new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation())); 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 abe7c008f..55844d9d9 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 @@ -103,10 +103,11 @@ public class ContextSchemasTest { assertNotEquals(0, schema.hashCode()); - assertEquals(schema, schema); + // disabling sonar because this code tests the equals() method + assertEquals(schema, schema); // NOSONAR assertEquals(schema, clonedSchema); assertNotNull(schema); - assertNotEquals(schema, (Object) "Hello"); + assertNotEquals(schema, "Hello"); assertNotEquals(schema, new AxContextSchema(new AxArtifactKey(), "Flavour", "Def")); assertNotEquals(schema, new AxContextSchema(newKey, "Flavour", "Def")); assertNotEquals(schema, new AxContextSchema(newKey, "NewSchemaFlavour", "Def")); @@ -165,10 +166,9 @@ public class ContextSchemasTest { assertNotEquals(0, schemas.hashCode()); - assertEquals(schemas, schemas); assertEquals(schemas, clonedSchemas); assertNotNull(schemas); - assertNotEquals(schemas, (Object) "Hello"); + assertNotEquals(schemas, "Hello"); assertNotEquals(schemas, new AxContextSchemas(new AxArtifactKey())); assertEquals(0, schemas.compareTo(schemas)); -- cgit 1.2.3-korg