From d879346e830b810eeccf8283fa16e04a9cfafbc8 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Tue, 7 Jul 2020 13:18:20 +0100 Subject: Fix assertTrue SONAR issues in apex-pdp/contex and apex-pdp/core Replace assertTrue with assertEquals and assertFalse with assertNotEquals in apex-pdp/client apex-pdp/context and apex-pdp/core Issue-ID: POLICY-2690 Change-Id: Ic1e69c75e5f8f887cac135b6728b007faf4b19a6 Signed-off-by: JvD_Ericsson --- .../policy/apex/context/impl/ContextAlbumImplTest.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'context/context-management/src') diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java index ad165c3c5..51802919c 100644 --- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java +++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +22,7 @@ package org.onap.policy.apex.context.impl; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -337,20 +338,20 @@ public class ContextAlbumImplTest { distributor.init(axContextAlbum.getKey()); ContextAlbumImpl album = new ContextAlbumImpl(axContextAlbum, distributor, new LinkedHashMap()); - assertTrue(album.hashCode() != 0); + assertNotEquals(0, album.hashCode()); assertEquals(0, album.compareTo(album)); assertEquals(1, album.compareTo(null)); - assertTrue(album.equals(album)); - assertFalse(album.equals(new DummyContextAlbumImpl())); + assertEquals(album, album); + assertNotEquals(album, new DummyContextAlbumImpl()); ContextAlbumImpl otherAlbum = new ContextAlbumImpl(axContextAlbum, distributor, new LinkedHashMap()); - assertTrue(album.equals(otherAlbum)); + assertEquals(album, otherAlbum); otherAlbum.put("Key", 123); - assertFalse(album.equals(otherAlbum)); + assertNotEquals(album, otherAlbum); try { otherAlbum.put("Key", "BadValue"); @@ -366,7 +367,7 @@ public class ContextAlbumImplTest { otherAxContextAlbum.setItemSchema(simpleStringSchema.getKey()); otherAlbum = new ContextAlbumImpl(otherAxContextAlbum, distributor, new LinkedHashMap()); - assertFalse(album.equals(otherAlbum)); + assertNotEquals(album, otherAlbum); try { album.flush(); @@ -379,7 +380,7 @@ public class ContextAlbumImplTest { ModelService.registerModel(AxContextAlbums.class, albums); albums.getAlbumsMap().put(axContextAlbum.getKey(), axContextAlbum); distributor.createContextAlbum(album.getKey()); - + album.flush(); ModelService.clear(); -- cgit 1.2.3-korg