clamp sonar fix on test code and the rest 19/123519/18
authorTaka Cho <takamune.cho@att.com>
Tue, 24 Aug 2021 17:03:02 +0000 (13:03 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 27 Aug 2021 12:58:58 +0000 (12:58 +0000)
- rename files to "...ItTestCase" to comply SONAR
  and checkstyle
- surefire plugin include *Test.java files
- failsafe plugin include *ItTestCase.java files
- use assertEquals etc.
- replace to "var"
- remove unused import

Issue-ID: POLICY-3452
Change-Id: I2e6e829726c4585f5f8bc985f4e8f2b88d17aef1
Signed-off-by: Taka Cho <takamune.cho@att.com>
58 files changed:
models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/rest/instantiation/InstantiationOrderStateResponse.java
participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/web/RuntimeErrorController.java
runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java
runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java
runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java
runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java
runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java
runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionAspectTest.java
runtime/pom.xml
runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java
runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java
runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java
runtime/src/main/java/org/onap/policy/clamp/clds/config/ClampProperties.java
runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java
runtime/src/main/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponse.java
runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java
runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/templates/JsonTemplate.java
runtime/src/main/java/org/onap/policy/clamp/clds/util/LoggingUtils.java
runtime/src/main/java/org/onap/policy/clamp/loop/LoopService.java
runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java
runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java
runtime/src/main/java/org/onap/policy/clamp/loop/template/LoopElementModel.java
runtime/src/main/java/org/onap/policy/clamp/loop/template/PolicyModel.java
runtime/src/main/java/org/onap/policy/clamp/policy/microservice/MicroServicePolicy.java
runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java
runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java
runtime/src/test/java/org/onap/policy/clamp/clds/config/CldsUserJsonDecoderTest.java
runtime/src/test/java/org/onap/policy/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/AuthorizationControllerItCase.java with 97% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/CldsHealthcheckServiceItCase.java with 92% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java with 99% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/RobotItCase.java with 99% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItCase.java with 94% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/config/SdcControllersConfigurationItCase.java with 96% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/it/sdc/controller/SdcSingleControllerItCase.java with 98% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java with 97% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/model/dcae/DcaeInventoryResponseTest.java
runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java with 92% similarity]
runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateFieldTest.java
runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/JsonTemplateTest.java
runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java with 98% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java with 99% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/DeployFlowTestItCase.java with 96% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/ExternalComponentStateTest.java
runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/LoopControllerTestItCase.java with 96% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/LoopLogServiceTestItCase.java with 94% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/LoopRepositoriesItCase.java with 95% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java with 98% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/LoopTemplatesServiceItCase.java with 98% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java with 98% similarity]
runtime/src/test/java/org/onap/policy/clamp/loop/ServiceTest.java
runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/policy/downloader/PolicyEngineControllerTestItCase.java with 94% similarity]
runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeCommissioningResponseTestItCase.java with 96% similarity]
runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItTestCase.java [moved from runtime/src/test/java/org/onap/policy/clamp/tosca/DictionaryServiceItCase.java with 94% similarity]
runtime/src/test/java/org/onap/policy/clamp/util/PassDecoderTest.java
runtime/src/test/java/org/onap/policy/clamp/util/SemanticVersioningTest.java

index 7140791..762b927 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  * Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -30,7 +32,6 @@ import javax.ws.rs.core.Response;
 import lombok.NonNull;
 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
 import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
-import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse;
 import org.onap.policy.models.base.PfAuthorative;
 import org.onap.policy.models.base.PfConceptKey;
 import org.onap.policy.models.base.PfKey;
@@ -197,7 +198,7 @@ public class ControlLoopProvider extends AbstractModelsProvider {
         Map<String, ToscaNodeTemplate> savedNodeTemplates = new HashMap<>();
 
         serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().forEach((key, template) -> {
-            JpaToscaNodeTemplate jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
+            var jpaToscaNodeTemplate = new JpaToscaNodeTemplate(template);
 
             getPfDao().create(jpaToscaNodeTemplate);
 
index 5943dc5..1ddce78 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  *  ================================================================================
+ * Modifications Copyright (C) 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.
  *  You may obtain a copy of the License at
@@ -19,7 +21,6 @@
 
 package org.onap.policy.clamp.controlloop.models.messages.rest.instantiation;
 
-import java.util.List;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
index 5cf1b0d..3d8308b 100644 (file)
@@ -25,7 +25,6 @@ package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
 import org.apache.http.HttpStatus;
 import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ClampEndPoints;
 import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
-import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent;
 import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
 import org.springframework.stereotype.Component;
 
index 2dc7a6b..ac2dba3 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -83,7 +85,7 @@ public class RuntimeErrorController implements ErrorController {
         Map<String, Object> map = this.errorAttributes.getErrorAttributes(new ServletWebRequest(request),
                 ErrorAttributeOptions.defaults());
 
-        StringBuilder sb = new StringBuilder();
+        var sb = new StringBuilder();
         final Object error = map.get("error");
         if (error != null) {
             sb.append(error.toString()).append(" ");
index b395734..c68b7fd 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
index a053379..65149a7 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  * Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -204,7 +206,7 @@ public class SupervisionScanner {
             return;
         }
 
-        boolean completed = true;
+        var completed = true;
         for (ControlLoopElement element : controlLoop.getElements().values()) {
             if (!element.getState().equals(element.getOrderedState().asState())) {
                 completed = false;
index 35219bb..6df030d 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  * Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -59,7 +61,7 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
         }
         controlLoopUpdateMsg.setParticipantUpdatesList(participantUpdates);
 
-        LOGGER.debug("ControlLoopUpdate message sent", controlLoopUpdateMsg);
+        LOGGER.debug("ControlLoopUpdate message sent {}", controlLoopUpdateMsg);
         super.send(controlLoopUpdateMsg);
     }
 
@@ -68,7 +70,7 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
         if (participantUpdates.isEmpty()) {
             participantUpdates.add(getControlLoopElementList(clElement));
         } else {
-            boolean participantExists = false;
+            var participantExists = false;
             for (ParticipantUpdates participantUpdate : participantUpdates) {
                 if (participantUpdate.getParticipantId().equals(clElement.getParticipantId())) {
                     participantUpdate.getControlLoopElementList().add(clElement);
@@ -82,7 +84,7 @@ public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher<Con
     }
 
     private ParticipantUpdates getControlLoopElementList(ControlLoopElement clElement) {
-        ParticipantUpdates participantUpdate = new ParticipantUpdates();
+        var participantUpdate = new ParticipantUpdates();
         List<ControlLoopElement> controlLoopElementList = new ArrayList<>();
         participantUpdate.setParticipantId(clElement.getParticipantId());
         controlLoopElementList.add(clElement);
index d239f38..efd2625 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  * Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -36,7 +38,6 @@ import org.onap.policy.models.provider.PolicyModelsProvider;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplates;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -117,7 +118,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
             participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
                 controlLoopElementDefinitionList));
         } else {
-            boolean participantExists = false;
+            var participantExists = false;
             for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
                 if (participantDefinitionUpdate.getParticipantId().equals(clParticipantId)) {
                     participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
index 5f885ec..3ac6b6f 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -229,7 +231,7 @@ class TestMonitoringProvider {
         var element = new ControlLoopElement();
         element.setParticipantId(new ToscaConceptIdentifier("name1", "1.001"));
         controlLoop.setElements(Map.of(UUID.randomUUID(), element));
-        when(mockClProvider.getControlLoop(eq(new ToscaConceptIdentifier("testName", "1.001"))))
+        when(mockClProvider.getControlLoop(new ToscaConceptIdentifier("testName", "1.001")))
                 .thenReturn(controlLoop);
 
         ParticipantStatisticsList getResponse = provider.fetchParticipantStatsPerControlLoop("testName", "1.001");
index 30ee9b1..b31aa8e 100644 (file)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -37,7 +39,7 @@ class SupervisionAspectTest {
         var supervisionScanner = spy(mock(SupervisionScanner.class));
         try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
             supervisionAspect.schedule();
-            verify(supervisionScanner, timeout(500)).run(eq(true));
+            verify(supervisionScanner, timeout(500)).run(true);
         }
     }
 
@@ -47,7 +49,7 @@ class SupervisionAspectTest {
         try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
             supervisionAspect.doCheck();
             supervisionAspect.doCheck();
-            verify(supervisionScanner, timeout(500).times(2)).run(eq(false));
+            verify(supervisionScanner, timeout(500).times(2)).run(false);
         }
     }
 
@@ -60,7 +62,7 @@ class SupervisionAspectTest {
 
         try (var supervisionAspect = new SupervisionAspect(supervisionScanner)) {
             supervisionAspect.handleParticipantStatus(participantStatusMessage);
-            verify(supervisionScanner, timeout(500)).handleParticipantStatus(eq(identifier));
+            verify(supervisionScanner, timeout(500)).handleParticipantStatus(identifier);
         }
     }
 }
index 3a8ece3..ef15198 100644 (file)
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
+                    <includes>
+                        <include>**/*Test.java</include>
+                    </includes>
                     <forkCount>1C</forkCount>
                     <reuseForks>true</reuseForks>
                     <useSystemClassLoader>false</useSystemClassLoader>
                                 </additionalClasspathElement>
                             </additionalClasspathElements>
                             <includes>
-                                <include>**/*ItCase.java</include>
+                                <include>**/*ItTestCase.java</include>
                             </includes>
                             <forkCount>1C</forkCount>
                             <reuseForks>true</reuseForks>
index 62614e7..cf639a3 100644 (file)
@@ -35,7 +35,6 @@ import org.onap.policy.common.utils.logging.LoggerUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
index 0e520de..1e5b003 100644 (file)
@@ -26,7 +26,6 @@
 package org.onap.policy.clamp.clds;
 
 import java.io.IOException;
-import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -48,7 +47,6 @@ import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.core.userdetails.User;
-import org.springframework.web.context.WebApplicationContext;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 
 public class ClampServlet extends CamelHttpTransportServlet {
index 27f706d..8f492c7 100644 (file)
@@ -34,7 +34,6 @@ import java.util.Date;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
-import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.ExchangeBuilder;
 import org.onap.policy.clamp.clds.exception.cds.CdsParametersException;
 import org.onap.policy.clamp.clds.model.cds.CdsBpWorkFlowListResponse;
index 34f0662..0ac58fc 100644 (file)
@@ -24,7 +24,6 @@
 package org.onap.policy.clamp.clds.config;
 
 import java.io.IOException;
-import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import org.apache.commons.io.IOUtils;
 import org.springframework.beans.factory.annotation.Autowired;
index eb9de05..7224493 100644 (file)
@@ -26,7 +26,6 @@ package org.onap.policy.clamp.clds.filter;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.StandardCopyOption;
index 9f5300a..9862728 100644 (file)
@@ -1,13 +1,10 @@
-
 /*-
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
- * Modifications Copyright (c) 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.
  * You may obtain a copy of the License at
index 89046af..2ca463e 100644 (file)
 package org.onap.policy.clamp.clds.sdc.controller.installer;
 
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Enumeration;
 import java.util.HashMap;
index 5c96f2c..8e61996 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -148,9 +148,9 @@ public class JsonTemplate {
      * @return a boolean
      */
     public boolean checkFields(JsonTemplate jsonTemplate) {
-        boolean duplicateFields = false;
+        var duplicateFields = false;
         if (jsonTemplate.getJsonTemplateFields().size() == this.getJsonTemplateFields().size()) {
-            int countMatchingFields = 0;
+            var countMatchingFields = 0;
             //loop each component of first
             for (JsonTemplateField jsonTemplateFieldToCheck : jsonTemplate.getJsonTemplateFields()) {
                 for (JsonTemplateField jsonTemplateField : this.getJsonTemplateFields()) {
index 5d09c06..fcd375a 100644 (file)
@@ -292,7 +292,7 @@ public class LoggingUtils {
      * @param targetServiceName The target service name
      */
     public void invoke(String targetEntity, String targetServiceName) {
-        final String invocationId = UUID.randomUUID().toString();
+        final var invocationId = UUID.randomUUID().toString();
 
         invokeContext(targetEntity, targetServiceName, invocationId);
 
@@ -396,7 +396,7 @@ public class LoggingUtils {
 
     private <T extends URLConnection> T invokeGeneric(final T con, String targetEntity,
                                                       String targetServiceName) {
-        final String invocationId = UUID.randomUUID().toString();
+        final var invocationId = UUID.randomUUID().toString();
 
         // Set standard HTTP headers on (southbound request) builder.
         con.setRequestProperty(OnapLogConstants.Headers.REQUEST_ID,
index 946edd7..9449c25 100644 (file)
 package org.onap.policy.clamp.loop;
 
 import com.google.gson.JsonObject;
-import java.io.IOException;
 import java.util.List;
 import java.util.Set;
 import javax.persistence.EntityNotFoundException;
 import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
 import org.onap.policy.clamp.loop.template.LoopTemplatesService;
-import org.onap.policy.clamp.loop.template.PolicyModel;
 import org.onap.policy.clamp.loop.template.PolicyModelsService;
 import org.onap.policy.clamp.policy.microservice.MicroServicePolicy;
 import org.onap.policy.clamp.policy.microservice.MicroServicePolicyService;
index 5336580..10d98e3 100644 (file)
@@ -120,7 +120,7 @@ public class CsarServiceInstaller {
      * @throws SdcArtifactInstallerException The SdcArtifactInstallerException
      */
     public boolean isServiceAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException {
-        boolean alreadyInstalled = true;
+        var alreadyInstalled = true;
         var serviceDetails = JsonUtils.GSON.fromJson(
                 JsonUtils.GSON.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class);
         alreadyInstalled = serviceRepository.existsById(serviceDetails.get("UUID").getAsString());
index cc4e4c2..c955d26 100644 (file)
@@ -33,7 +33,6 @@ import javax.persistence.Table;
 import javax.persistence.Transient;
 import org.hibernate.annotations.Type;
 import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
 import org.onap.policy.clamp.clds.util.JsonUtils;
 import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
 import org.slf4j.Logger;
index 7477ae3..e15731f 100644 (file)
@@ -163,8 +163,8 @@ public class LoopElementModel extends AuditEntity implements Serializable {
 
     @Override
     public int hashCode() {
-        final int prime = 31;
-        int result = 1;
+        final var prime = 31;
+        var result = 1;
         result = prime * result + ((name == null) ? 0 : name.hashCode());
         return result;
     }
index 0d57caa..741530e 100644 (file)
@@ -37,7 +37,6 @@ import javax.persistence.ManyToMany;
 import javax.persistence.Table;
 import org.hibernate.annotations.Type;
 import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
 import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
 import org.onap.policy.clamp.loop.common.AuditEntity;
 import org.onap.policy.clamp.util.SemanticVersioning;
index 96edfa1..3f0f4e7 100644 (file)
@@ -37,7 +37,6 @@ import javax.persistence.ManyToMany;
 import javax.persistence.Table;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
 import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
 import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
 import org.onap.policy.clamp.loop.Loop;
index c7d67bd..203f277 100644 (file)
@@ -40,7 +40,6 @@ import javax.persistence.Table;
 import javax.persistence.Transient;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
 import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySupport;
 import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType;
 import org.onap.policy.clamp.loop.Loop;
index 63df3a7..84bf72b 100644 (file)
@@ -32,8 +32,6 @@ import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySuppo
 import org.onap.policy.clamp.loop.Loop;
 import org.onap.policy.clamp.loop.template.PolicyModelsRepository;
 import org.onap.policy.clamp.policy.PolicyService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
index 605ab99..59d9e73 100644 (file)
@@ -6,6 +6,7 @@
  *                             reserved.
  * ================================================================================
  * Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 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.
@@ -71,7 +72,7 @@ public class CldsUserJsonDecoderTest {
         assertThat(usersArray).hasSize(1);
         CldsUser user = usersArray[0];
         assertThat(user.getUser()).isEqualTo(user1);
-        assertThat(user.getPassword()).isEqualTo(null);
+        assertThat(user.getPassword()).isNull();
         assertThat(user.getPermissionsString()).isEmpty();
     }
 
index 7390b65..eed3f4e 100644 (file)
@@ -74,8 +74,8 @@ public class SdcSingleControllerConfigurationTest {
         assertEquals(10, sdcConfig.getPollingInterval());
         assertEquals(30, sdcConfig.getPollingTimeout());
 
-        assertThat(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST)
-                .hasSameSizeAs(sdcConfig.getRelevantArtifactTypes());
+        assertThat(sdcConfig.getRelevantArtifactTypes())
+                .hasSameSizeAs(SdcSingleControllerConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST);
         assertEquals("ThePassword", sdcConfig.getKeyStorePassword());
         assertTrue(sdcConfig.activateServerTLSAuth());
         assertThat(sdcConfig.getMsgBusAddress()).contains("localhost");
@@ -103,6 +103,6 @@ public class SdcSingleControllerConfigurationTest {
     public final void testConsumerGroupWithNull() throws IOException {
         SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-NULL.json",
                 "sdc-controller1");
-        assertTrue(sdcConfig.getConsumerGroup() == null);
+        assertNull(sdcConfig.getConsumerGroup());
     }
 }
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Modifications Copyright (c) 2019 Samsung
@@ -56,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
  */
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-public class AuthorizationControllerItCase {
+public class AuthorizationControllerItTestCase {
 
     @Autowired
     private AuthorizationController auth;
@@ -2,19 +2,19 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018, 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. 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END============================================
  * ===================================================================
@@ -39,7 +39,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class CldsHealthcheckServiceItCase {
+public class CldsHealthcheckServiceItTestCase {
 
     @Autowired
     private CldsHealthcheckService cldsHealthcheckService;
@@ -59,7 +59,7 @@ import org.springframework.web.client.RestTemplate;
 @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
 @TestPropertySource(locations = "classpath:https/https-test.properties")
 @DirtiesContext
-public class HttpsItCase {
+public class HttpsItTestCase {
 
     @Value("${server.port}")
     private String httpsPort;
@@ -56,12 +56,12 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
 @TestPropertySource(locations = "classpath:robotframework/robotframework-test.properties")
 @DirtiesContext
-public class RobotItCase {
+public class RobotItTestCase {
 
     @Value("${server.port}")
     private String httpPort;
     private static final int TIMEOUT_S = 150;
-    protected static final Logger logger = LoggerFactory.getLogger(RobotItCase.class);
+    protected static final Logger logger = LoggerFactory.getLogger(RobotItTestCase.class);
 
     @Test
     public void robotTests() throws Exception {
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
-public class CldsReferencePropertiesItCase {
+public class CldsReferencePropertiesItTestCase {
 
     @Autowired
     private ClampProperties refProp;
@@ -20,8 +20,8 @@
 
 package org.onap.policy.clamp.clds.it.config;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.gson.JsonSyntaxException;
@@ -44,7 +44,7 @@ import org.springframework.test.util.ReflectionTestUtils;
 @RunWith(SpringRunner.class)
 @SpringBootTest
 @ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class SdcControllersConfigurationItCase {
+public class SdcControllersConfigurationItTestCase {
 
     @Autowired
     private SdcControllersConfiguration sdcControllersConfiguration;
@@ -59,7 +59,7 @@ public class SdcControllersConfigurationItCase {
         loadFile("classpath:clds/sdc-controllers-config.json");
         Map<String, SdcSingleControllerConfiguration> mapResult = sdcControllersConfiguration
                 .getAllDefinedControllers();
-        assertTrue(mapResult.size() == 2);
+        assertThat(mapResult).hasSize(2);
         assertEquals("sdc-controller1", mapResult.get("sdc-controller1").getSdcControllerName());
         assertEquals("sdc-controller2", mapResult.get("sdc-controller2").getSdcControllerName());
     }
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Modifications Copyright (c) 2019 Samsung
@@ -58,7 +58,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 @RunWith(SpringRunner.class)
 @SpringBootTest
 @ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class SdcSingleControllerItCase {
+public class SdcSingleControllerItTestCase {
 
     private static final String CSAR_ARTIFACT_NAME = "testArtifact.csar";
     private static final String SERVICE_UUID = "serviceUUID";
@@ -115,7 +115,7 @@ public class SdcSingleControllerItCase {
         // when
         sdcSingleController.treatNotification(buildFakeSdcNotification());
         // then
-        Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isEqualTo(0);
+        Assertions.assertThat(sdcSingleController.getNbOfNotificationsOngoing()).isZero();
     }
 
     @Test
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class DcaeInventoryResponseCacheTestItCase {
+public class DcaeInventoryResponseCacheItTestCase {
 
     public static DcaeInventoryCache inventoryCache = new DcaeInventoryCache();
 
index a246e0e..25b3b92 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,7 +53,7 @@ public class DcaeInventoryResponseTest {
 
         int value = 0;
         for (DcaeInventoryResponse inventoryResponse : responseSet) {
-            assertThat(Integer.valueOf(inventoryResponse.getAsdcResourceId()) == value++).isTrue();
+            assertThat(Integer.valueOf(inventoryResponse.getAsdcResourceId())).isSameAs(value++);
         }
     }
 }
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,7 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(classes = Application.class)
-public class DictionaryRepositoriesTestItCase {
+public class DictionaryRepositoriesTestItTestCase {
     @Autowired
     private DictionaryRepository dictionaryRepository;
 
@@ -76,13 +76,13 @@ public class DictionaryRepositoriesTestItCase {
 
         dictionaryRepository.save(dictionaryTest1);
         List<String> res1 = dictionaryRepository.getAllDictionaryNames();
-        assertThat(res1.size()).isGreaterThanOrEqualTo(1);
+        assertThat(res1.size()).isPositive();
         assertThat(res1).contains("testDictionary1");
 
         dictionaryRepository.save(dictionaryTest2);
         List<String> res2 = dictionaryRepository.getAllDictionaryNames();
         assertThat(res2.size()).isGreaterThanOrEqualTo(2);
-        assertThat(res2).contains("testDictionary1");
-        assertThat(res2).contains("testDictionary2");
+        assertThat(res2).contains("testDictionary1")
+            .contains("testDictionary2");
     }
 }
index 3eaa0ce..ad85937 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,11 +49,11 @@ public class JsonTemplateFieldTest extends TestCase {
      * Test equals method.
      */
     public void testEqualsMethod() {
-        assertTrue(field1.equals(field2));
-        assertTrue(field1.equals(field3));
-        assertTrue(field1.equals(field4));
-        assertTrue(field1.equals(field5));
-        assertTrue(field1.equals(field6));
+        assertEquals(field1, field2);
+        assertEquals(field1, field3);
+        assertEquals(field1, field4);
+        assertEquals(field1, field5);
+        assertEquals(field1, field6);
     }
 
     /**
@@ -64,6 +64,6 @@ public class JsonTemplateFieldTest extends TestCase {
         assertFalse(field1.compareWithField(field3));
         assertFalse(field1.compareWithField(field4));
         assertFalse(field1.compareWithField(field5));
-        assertTrue(field1.equals(field6));
+        assertEquals(field1, field6);
     }
-}
\ No newline at end of file
+}
index dc27d8a..63bc363 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,12 +58,11 @@ public class JsonTemplateTest extends TestCase {
         toTest.setVisibility("moreField", true);
         toTest.setStatic("moreField", true);
         toTest.updateValueField("moreField", "testValue");
-        
+
         assertTrue(toTest.isVisible("moreField"));
-        assertTrue(toTest.getSpecificField("moreField").getValue().equals("testValue"));
+        assertEquals("testValue", toTest.getSpecificField("moreField").getValue());
         assertTrue(toTest.fieldStaticStatus("moreField"));
-        assertTrue(toTest.toString()
-            .equals(" templateFields : [type null null null, description null null null, "
-            + "enum null null null, moreField testValue true true]"));
+        assertEquals(" templateFields : [type null null null, description null null null, "
+                + "enum null null null, moreField testValue true true]", toTest.toString());
     }
-}
\ No newline at end of file
+}
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(classes = Application.class)
 @ActiveProfiles({"clamp-default", "clamp-default-user", "default-dictionary-elements"})
-public class ToscaConverterWithDictionarySupportItCase {
+public class ToscaConverterWithDictionarySupportItTestCase {
 
     @Autowired
     private DictionaryService dictionaryService;
@@ -75,7 +75,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
 @ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
-public class CsarInstallerItCase {
+public class CsarInstallerItTestCase {
 
     private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
     private static final String CSAR_ARTIFACT_NAME_NO_CDS = "example/sdc/service_Vloadbalancerms_no_cds.csar";
@@ -312,7 +312,7 @@ public class CsarInstallerItCase {
         assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0]))
                 .getLoopElementModel().getName()).isNotEmpty();
 
-        assertThat(policyModelsRepository.findAll().size()).isGreaterThanOrEqualTo(1);
+        assertThat(policyModelsRepository.findAll().size()).isPositive();
         assertThat(policyModelsRepository
                 .existsById(new PolicyModelId("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"))).isTrue();
         assertThat(policyModelsRepository
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class DeployFlowTestItCase {
+public class DeployFlowItTestCase {
     private Gson gson = new Gson();
 
     @Autowired
@@ -159,7 +159,7 @@ public class DeployFlowTestItCase {
         camelContext.createProducerTemplate().send("direct:undeploy-loop", myCamelExchange);
 
         Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
-        assertThat(loopAfterTest.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
+        assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).contains("/uninstall");
         assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
     }
 
@@ -196,9 +196,8 @@ public class DeployFlowTestItCase {
         Loop loopAfterTest = loopService.getLoop("ControlLoopTest2");
         Set<MicroServicePolicy> policyList = loopAfterTest.getMicroServicePolicies();
         for (MicroServicePolicy policy : policyList) {
-            assertThat(policy.getDcaeDeploymentStatusUrl().contains("/uninstall")).isTrue();
+            assertThat(policy.getDcaeDeploymentStatusUrl()).contains("/uninstall");
             assertThat(policy.getDcaeDeploymentId()).isNull();
-            
         }
         assertThat(loopAfterTest.getDcaeDeploymentStatusUrl()).isNull();
         assertThat(loopAfterTest.getDcaeDeploymentId()).isNull();
@@ -224,7 +223,7 @@ public class DeployFlowTestItCase {
                 "{\"param1\":\"value1\"}", true);
         loopTest.addMicroServicePolicy(microServicePolicy);
         loopService.saveOrUpdateLoop(loopTest);
-        assertThat(loopTest.getComponents().size()).isEqualTo(2);
+        assertThat(loopTest.getComponents()).hasSize(2);
         assertThat(loopTest.getComponent("DCAE")).isNotNull();
         assertThat(loopTest.getComponent("POLICY")).isNotNull();
         Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext).withProperty("loopObject", loopTest)
@@ -235,7 +234,7 @@ public class DeployFlowTestItCase {
         assertThat(loopTest.getComponent("DCAE").getState().getStateName()).isEqualTo("BLUEPRINT_DEPLOYED");
 
         Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
-        assertThat(loopAfterTest.getComponents().size()).isEqualTo(2);
+        assertThat(loopAfterTest.getComponents()).hasSize(2);
         assertThat(loopAfterTest.getComponent("DCAE")).isNotNull();
         assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
     }
@@ -263,7 +262,7 @@ public class DeployFlowTestItCase {
         loopTest.addMicroServicePolicy(microServicePolicy);
         loopTest.addMicroServicePolicy(microServicePolicy2);
         loopService.saveOrUpdateLoop(loopTest);
-        assertThat(loopTest.getComponents().size()).isEqualTo(3);
+        assertThat(loopTest.getComponents()).hasSize(3);
         assertThat(loopTest.getComponent("DCAE")).isNull();
         assertThat(loopTest.getComponent("DCAE_configPolicyTest")).isNotNull();
         assertThat(loopTest.getComponent("DCAE_configPolicyTest2")).isNotNull();
@@ -279,7 +278,7 @@ public class DeployFlowTestItCase {
                 .isEqualTo("BLUEPRINT_DEPLOYED");
 
         Loop loopAfterTest = loopService.getLoop("ControlLoopTest");
-        assertThat(loopAfterTest.getComponents().size()).isEqualTo(3);
+        assertThat(loopAfterTest.getComponents()).hasSize(3);
         assertThat(loopAfterTest.getComponent("DCAE")).isNull();
         assertThat(loopAfterTest.getComponent("POLICY")).isNotNull();
         assertThat(loopTest.getComponent("DCAE_configPolicyTest")).isNotNull();
index a73b278..567cad6 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,34 +34,34 @@ public class ExternalComponentStateTest {
 
     @Test
     public void generalTest() {
-        assertThat(state.toString()).isEqualTo("NOT_SENT");
+        assertThat(state).hasToString("NOT_SENT");
         state.setLevel(70);
         assertThat(state.getLevel()).isEqualTo(70);
     }
 
     @Test
     public void equalsTest() {
-        assertThat(state.equals(null)).isEqualTo(false);
+        assertThat(state.equals(null)).isFalse();
 
         ExternalComponentState state2 =  new ExternalComponentState("NOT_SENT",
                "The policies defined have NOT yet been created on the policy engine", 90);
-        assertThat(state.equals(state2)).isEqualTo(true);
+        assertThat(state.equals(state2)).isTrue();
 
-        assertThat(state.equals(12)).isEqualTo(false);
+        assertThat(state.equals(12)).isFalse();
 
         state2.setLevel(70);
-        assertThat(state.equals(state2)).isEqualTo(true);
+        assertThat(state.equals(state2)).isTrue();
 
         ExternalComponentState state3 =  new ExternalComponentState("SENT",
                 "The policies defined have NOT yet been created on the policy engine", 90);
-        assertThat(state.equals(state3)).isEqualTo(false);
+        assertThat(state.equals(state3)).isFalse();
 
         ExternalComponentState state4 =  new ExternalComponentState(null,
                 "The policies defined have NOT yet been created on the policy engine", 90);
         ExternalComponentState state5 =  new ExternalComponentState(null,
                 "The policies defined have NOT yet been", 50);
-        assertThat(state4.equals(state3)).isEqualTo(false);
-        assertThat(state4.equals(state5)).isEqualTo(true);
+        assertThat(state4.equals(state3)).isFalse();
+        assertThat(state4.equals(state5)).isTrue();
     }
 
     @Test
@@ -79,4 +79,4 @@ public class ExternalComponentStateTest {
         assertThat(state.compareTo(state4)).isEqualTo(-1);
 
     }
-}
\ No newline at end of file
+}
@@ -4,7 +4,9 @@
  * ================================================================================
  * Copyright (C) 2019 Nokia Intellectual Property. All rights
  *                             reserved.
+ * ================================================================================
  * Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd.
+ * Modifications Copyright (C) 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.
@@ -52,7 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class LoopControllerTestItCase {
+public class LoopControllerItTestCase {
 
     private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
     private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
@@ -161,7 +163,7 @@ public class LoopControllerTestItCase {
         Set<OperationalPolicy> opPolicyList = newLoop.getOperationalPolicies();
         assertThat(opPolicyList.size()).isEqualTo(1);
         for (OperationalPolicy policy : opPolicyList) {
-            assertThat(policy.getName().contains("OPERATIONAL_serviceName")).isTrue();
+            assertThat(policy.getName()).contains("OPERATIONAL_serviceName");
             Assertions.assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel");
             Assertions.assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0");
         }
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2019 Huawei Technologies Co., Ltd.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -41,7 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class LoopLogServiceTestItCase {
+public class LoopLogServiceItTestCase {
 
     private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
     private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
@@ -58,7 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(classes = Application.class)
-public class LoopRepositoriesItCase {
+public class LoopRepositoriesItTestCase {
 
     private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
 
@@ -177,21 +177,21 @@ public class LoopRepositoriesItCase {
 
         assertThat(loopInDb).isEqualToIgnoringGivenFields(loopTest, "components", "createdDate", "updatedDate",
                 "createdBy", "updatedBy");
-        assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(true);
-        assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(true);
-        assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
+        assertThat(loopRepository.existsById(loopTest.getName())).isTrue();
+        assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isTrue();
+        assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isTrue();
         assertThat(loopLogRepository.existsById(loopLog.getId())).isEqualTo(true);
-        assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
-        assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
-        assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
+        assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+        assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+        assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isTrue();
         assertThat(microServiceModelsRepository.existsById(
                 loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
-                .isEqualTo(true);
+                .isTrue();
         assertThat(policyModelsRepository.existsById(new PolicyModelId(
                 loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
                         .first().getPolicyModelType(),
                 loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
-                        .first().getVersion()))).isEqualTo(true);
+                        .first().getVersion()))).isTrue();
 
         // Now attempt to read from database
         Loop loopInDbRetrieved = loopRepository.findById(loopTest.getName()).get();
@@ -238,21 +238,21 @@ public class LoopRepositoriesItCase {
         // Attempt to delete the object and check it has well been cascaded
 
         loopRepository.delete(loopInDbRetrieved);
-        assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(false);
-        assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(false);
-        assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
-        assertThat(loopLogRepository.existsById(loopLog.getId())).isEqualTo(false);
-        assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isEqualTo(true);
-        assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isEqualTo(true);
+        assertThat(loopRepository.existsById(loopTest.getName())).isFalse();
+        assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isFalse();
+        assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isTrue();
+        assertThat(loopLogRepository.existsById(loopLog.getId())).isFalse();
+        assertThat(loopTemplateRepository.existsById(loopInDb.getLoopTemplate().getName())).isTrue();
+        assertThat(servicesRepository.existsById(loopInDb.getModelService().getServiceUuid())).isTrue();
         assertThat(microServiceModelsRepository.existsById(
                 loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getName()))
-                .isEqualTo(true);
+                .isTrue();
 
         assertThat(policyModelsRepository.existsById(new PolicyModelId(
                 loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
                         .first().getPolicyModelType(),
                 loopInDb.getLoopTemplate().getLoopElementModelsUsed().first().getLoopElementModel().getPolicyModels()
-                        .first().getVersion()))).isEqualTo(true);
+                        .first().getVersion()))).isTrue();
 
     }
 }
@@ -51,7 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class LoopServiceTestItCase {
+public class LoopServiceItTestCase {
 
     private static final String EXAMPLE_LOOP_NAME = "ClosedLoopTest";
     private static final String EXAMPLE_JSON = "{\"testName\":\"testValue\"}";
@@ -330,10 +330,10 @@ public class LoopServiceTestItCase {
         loopService.updateAndSaveMicroservicePolicies(EXAMPLE_LOOP_NAME, Lists.newArrayList(microServicePolicy));
 
         // Verify it's there
-        assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null)).isNotNull();
+        assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME)).isPresent();
         loopService.deleteLoop(EXAMPLE_LOOP_NAME);
         // Verify it's well deleted and has been cascaded, except for Microservice
-        assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null)).isNull();
+        assertThat(loopsRepository.findById(EXAMPLE_LOOP_NAME)).isNotPresent();
         assertThat(microServicePolicyService.isExisting("microPolicy")).isTrue();
         assertThat(operationalPolicyService.isExisting("opPolicy")).isFalse();
         assertThat(loopLogService.isExisting(((LoopLog) loop.getLoopLogs().toArray()[0]).getId())).isFalse();
@@ -378,4 +378,4 @@ public class LoopServiceTestItCase {
     private Loop createTestLoop(String loopName, String loopBlueprint) {
         return new Loop(loopName);
     }
-}
\ No newline at end of file
+}
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,7 +46,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class LoopTemplatesServiceItCase {
+public class LoopTemplatesServiceItTestCase {
 
     @Autowired
     LoopTemplatesService loopTemplatesService;
@@ -55,7 +55,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class PolicyModelServiceItCase {
+public class PolicyModelServiceItTestCase {
 
     @Autowired
     PolicyModelsService policyModelsService;
@@ -98,8 +98,7 @@ public class PolicyModelServiceItCase {
         PolicyModel actualPolicyModel = policyModelsService.saveOrUpdatePolicyModel(policyModel);
 
         // then
-        assertThat(actualPolicyModel).isNotNull();
-        assertThat(actualPolicyModel).isEqualTo(policyModelsRepository
+        assertThat(actualPolicyModel).isNotNull().isEqualTo(policyModelsRepository
                 .findById(new PolicyModelId(actualPolicyModel.getPolicyModelType(),
                         actualPolicyModel.getVersion()))
                 .get());
index 8f28299..41fa611 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,11 +44,11 @@ public class ServiceTest {
 
         Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null, "1.0");
 
-        Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class), 
+        Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class),
                 JsonUtils.GSON.fromJson(resourceStr, JsonObject.class), "1.0");
 
-        assertThat(service1.equals(service2)).isEqualTo(true);
-        assertThat(service1.equals(service3)).isEqualTo(false);
+        assertThat(service2).isEqualTo(service1);
+        assertThat(service3).isNotEqualTo(service1);
     }
 
 }
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * Modifications Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
@@ -48,7 +48,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
 @ActiveProfiles({"clamp-default", "clamp-policy-controller"})
-public class PolicyEngineControllerTestItCase {
+public class PolicyEngineControllerItTestCase {
 
     @Autowired
     PolicyEngineController policyController;
@@ -72,9 +72,8 @@ public class PolicyEngineControllerTestItCase {
         List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
         assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(5);
         assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Drools",
-            null, "1.0.0"));
-        assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex",
-            null, "1.0.0"));
+                null, "1.0.0"))
+            .contains(new PolicyModel("onap.policies.controlloop.operational.common.Apex", null, "1.0.0"));
         assertThat(policyModelsList)
             .contains(new PolicyModel("onap.policies.controlloop.guard.common.FrequencyLimiter", null, "1.0.0"));
         assertThat(policyModelsList)
@@ -2,6 +2,8 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
+ * Modifications Copyright (C) 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.
  * You may obtain a copy of the License at
@@ -36,7 +38,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class RuntimeCommissioningResponseTestItCase {
+public class RuntimeCommissioningResponseItTestCase {
     @Autowired
     CamelContext camelContext;
 
@@ -86,7 +88,7 @@ public class RuntimeCommissioningResponseTestItCase {
                 .withProperty("raiseHttpExceptionFlag", "true")
                 .build());
 
-        assertThat(exchangeResponse.getIn().getBody().toString()).isEqualTo(SAMPLE_TOSCA_TEMPLATE);
+        assertThat(exchangeResponse.getIn().getBody()).hasToString(SAMPLE_TOSCA_TEMPLATE);
     }
 
     @Test
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +24,7 @@
 package org.onap.policy.clamp.tosca;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -39,7 +40,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-public class DictionaryServiceItCase {
+public class DictionaryServiceItTestCase {
 
     @Autowired
     private DictionaryService dictionaryService;
@@ -124,7 +125,7 @@ public class DictionaryServiceItCase {
         assertTrue(updatedDictionary2.getDictionaryElements().contains(dictionaryElement));
         updatedDictionary2.getDictionaryElements().forEach(element -> {
             if (element.equals(dictionaryElement)) {
-                assertTrue(element.getDescription().equals(dictionaryElement.getDescription()));
+                assertEquals(dictionaryElement.getDescription(), element.getDescription());
             }
         });
 
@@ -172,7 +173,7 @@ public class DictionaryServiceItCase {
             dictionaryService.getDictionary("Test");
         } catch (Exception e) {
             assertThat(e).isInstanceOf(EntityNotFoundException.class);
-            assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Test"));
+            assertEquals("Couldn't find Dictionary named: Test", e.getMessage());
         }
     }
 
@@ -189,7 +190,7 @@ public class DictionaryServiceItCase {
         try {
             dictionaryService.getDictionary("Dictionary1");
         } catch (EntityNotFoundException e) {
-            assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Dictionary1"));
+            assertEquals("Couldn't find Dictionary named: Dictionary1", e.getMessage());
         }
     }
 
@@ -205,7 +206,7 @@ public class DictionaryServiceItCase {
         try {
             dictionaryService.getDictionary("Dictionary1");
         } catch (EntityNotFoundException e) {
-            assertTrue(e.getMessage().equals("Couldn't find Dictionary named: Dictionary1"));
+            assertEquals("Couldn't find Dictionary named: Dictionary1", e.getMessage());
         }
     }
 
index 7fd0cb9..eb5e1d5 100644 (file)
@@ -47,7 +47,7 @@ public class PassDecoderTest {
     @Test
     public final void testDecryption() throws Exception {
         String decodedPass = PassDecoder.decode(encrypted, "classpath:clds/aaf/org.onap.clamp.keyfile");
-        assertEquals(decodedPass, "China in the Spring");
+        assertEquals("China in the Spring", decodedPass);
         assertEquals("Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U", PassDecoder
                 .decode("enc:JPV4p067JlSXt2Fet9bfuI8JpkS4ZGYVcgypcPs98gXjgjCjTze_d3JxqmlKaaakdiOjIcEC_MJh6-5pJTLgdc",
                         "classpath:clds/aaf/org.onap.clamp.keyfile"));
index 604ce55..0ef10ae 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP CLAMP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -61,9 +61,9 @@ public class SemanticVersioningTest {
      */
     @Test
     public void compareEqualsTest() {
-        assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isEqualTo(0);
+        assertThat(SemanticVersioning.compare("1.0.0", "1.0.0")).isZero();
         assertThat(SemanticVersioning.compare("1.0.0.0", "1.0.0")).isEqualTo(1);
-        assertThat(SemanticVersioning.compare("1.2.3", "1.2.3")).isEqualTo(0);
+        assertThat(SemanticVersioning.compare("1.2.3", "1.2.3")).isZero();
         assertThat(SemanticVersioning.compare("1.2.3", "1.2.3.0")).isEqualTo(-1);
 
     }
@@ -73,7 +73,7 @@ public class SemanticVersioningTest {
      */
     @Test
     public void compareNullTest() {
-        assertThat(SemanticVersioning.compare(null, null)).isEqualTo(0);
+        assertThat(SemanticVersioning.compare(null, null)).isZero();
         assertThat(SemanticVersioning.compare(null, "1.0")).isEqualTo(-1);
         assertThat(SemanticVersioning.compare("1.0", null)).isEqualTo(1);
     }