import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiCustomQueryOperationTest extends BasicAaiOperation<Map<String, String>> {
+public class AaiCustomQueryOperationTest extends BasicAaiOperation {
private static final StandardCoder coder = new StandardCoder();
private static final String MY_LINK = "my-link";
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
-public class AaiGetOperationTest extends BasicAaiOperation<Void> {
+public class AaiGetOperationTest extends BasicAaiOperation {
private static final String MY_NAME = "my-operation-name";
private static final String PARAM_NAME = "my-param";
private static final String PARAM_VALUE = "my-value";
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiGetPnfOperationTest extends BasicAaiOperation<Void> {
+public class AaiGetPnfOperationTest extends BasicAaiOperation {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.controlloop.policy.PolicyResult;
-public class AaiGetTenantOperationTest extends BasicAaiOperation<Void> {
+public class AaiGetTenantOperationTest extends BasicAaiOperation {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
import java.util.Map;
import org.junit.Test;
-public class AaiUtilTest extends BasicAaiOperation<Void> {
+public class AaiUtilTest extends BasicAaiOperation {
@Test
public void testMakeHeaders() {
/**
* Superclass for various operator tests.
*/
-public abstract class BasicAaiOperation<Q> extends BasicHttpOperation<Q> {
+public abstract class BasicAaiOperation extends BasicHttpOperation {
/**
* Constructs the object using a default actor and operation name.
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.function.BiConsumer;
+import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appc.ResponseStatus;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperation {
+public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperation<Request> {
protected static final String[] IGNORE_FIELDS = {"RequestID", "subRequestID", "TimeStamp"};
protected static final String MY_DESCRIPTION = "my-description";
protected static final String MY_VNF = "my-vnf";
super.tearDownBasic();
}
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<Request> makeServer(TopicSink sink, TopicSource source) {
return new AppcLegacyTopicServer(sink, source);
}
import org.onap.policy.simulators.AppcLcmTopicServer;
import org.onap.policy.simulators.TopicServer;
-public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation {
+public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcLcmDmaapWrapper> {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String PAYLOAD_KEY1 = "key-A";
super.tearDownBasic();
}
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<AppcLcmDmaapWrapper> makeServer(TopicSink sink, TopicSource source) {
return new AppcLcmTopicServer(sink, source);
}
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.simulators.GuardSimulatorJaxRs;
-public class DecisionOperationTest extends BasicHttpOperation<DecisionRequest> {
+public class DecisionOperationTest extends BasicHttpOperation {
@Mock
private Consumer<OperationOutcome> started;
/**
* Superclass for various operator tests.
*/
-public abstract class BasicSdncOperation extends BasicHttpOperation<SdncRequest> {
+public abstract class BasicSdncOperation extends BasicHttpOperation {
/**
* Fields to be ignored when comparing requests with JSON.
*/
import org.onap.policy.simulators.TopicServer;
import org.powermock.reflect.Whitebox;
-public abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperation {
+public abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperation<PciMessage> {
protected PciMessage response;
super.tearDownBasic();
}
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<PciMessage> makeServer(TopicSink sink, TopicSource source) {
return new SdnrTopicServer(sink, source);
}
* HttpClient, as the JerseyClient does not support it. This will add the content-type
* and authorization headers, so they should not be included within "headers".
*
- * @param <Q> request type
* @param uri URI suffix, to be appended to the URI prefix
* @param headers headers to be included
* @param contentType content type of the request
* @return a future to await the response. Note: it's untested whether canceling this
* future will actually cancel the underlying HTTP request
*/
- protected <Q> CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType,
+ protected CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType,
String request, InvocationCallback<Response> callback) {
// TODO move to HttpOperation
/**
* Superclass for various operator tests.
*/
-public abstract class BasicSoOperation extends BasicHttpOperation<SoRequest> {
+public abstract class BasicSoOperation extends BasicHttpOperation {
protected static final String[] IGNORE_FIELDS = {"RequestID", "subRequestID", "seconds", "nanos"};
public static final String MODEL_CUSTOM_ID = "my-model-customization-id";
/**
* Superclass for various BidirectionalTopicOperation tests.
+ *
+ * @param <Q> request type
*/
-public abstract class BasicBidirectionalTopicOperation extends BasicOperation {
+public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation {
protected static final String MY_SINK = "my-sink";
protected static final String MY_SOURCE = "my-source";
protected static final int TIMEOUT_SEC = 10;
@Mock
protected BidirectionalTopicConfig config;
- @SuppressWarnings("rawtypes")
- private TopicServer topicServer;
+ private TopicServer<Q> topicServer;
/**
* Constructs the object using a default actor and operation name.
* @param source topic from which the simulator should receive messages
* @return a new topic server/simulator
*/
- @SuppressWarnings("rawtypes")
- protected abstract TopicServer makeServer(TopicSink sink, TopicSource source);
+ protected abstract TopicServer<Q> makeServer(TopicSink sink, TopicSource source);
/**
* Initializes a configuration.
/**
* Superclass for various HttpOperation tests.
- *
- * @param <Q> request type
*/
-public class BasicHttpOperation<Q> extends BasicOperation {
+public class BasicHttpOperation extends BasicOperation {
protected static final String MY_CLIENT = "my-client";
protected static final String BASE_URI = "http://my-host:6969/base-uri/";
protected static final String PATH = "my-path/";
@Mock
private BiConsumer<String, StandardCoderObject> listener;
- private BasicBidirectionalTopicOperation oper;
+ private BasicBidirectionalTopicOperation<String> oper;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
.withMessage("response is not a Map");
}
- private static class MyOperation extends BasicBidirectionalTopicOperation {
+ private static class MyOperation extends BasicBidirectionalTopicOperation<String> {
public MyOperation() {
super();
}
}
@Override
- @SuppressWarnings("rawtypes")
- protected TopicServer makeServer(TopicSink sink, TopicSource source) {
+ protected TopicServer<String> makeServer(TopicSink sink, TopicSource source) {
return new TopicServer<String>(sink, source, null, String.class) {
@Override
protected String process(String request) {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
- private BasicHttpOperation<String> oper;
+ private BasicHttpOperation oper;
@Before
public void setUp() throws Exception {
- oper = new BasicHttpOperation<>(ACTOR, OPERATION);
+ oper = new BasicHttpOperation(ACTOR, OPERATION);
oper.setUpBasic();
}
@Test
public void testBasicHttpOperation() {
- oper = new BasicHttpOperation<>();
+ oper = new BasicHttpOperation();
assertEquals(BasicOperation.DEFAULT_ACTOR, oper.actorName);
assertEquals(BasicOperation.DEFAULT_OPERATION, oper.operationName);
}
@Before
public void setUp() throws Exception {
- oper = new BasicHttpOperation<>(ACTOR, OPERATION);
+ oper = new BasicHttpOperation(ACTOR, OPERATION);
oper.setUpBasic();
}
@Test
public void testBasicHttpOperation() {
- oper = new BasicHttpOperation<>();
+ oper = new BasicHttpOperation();
assertEquals(BasicHttpOperation.DEFAULT_ACTOR, oper.actorName);
assertEquals(BasicHttpOperation.DEFAULT_OPERATION, oper.operationName);
}
import org.onap.policy.controlloop.actor.test.BasicHttpOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.simulators.Util;
-import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
-public abstract class BasicVfcOperation extends BasicHttpOperation<VfcRequest> {
+public abstract class BasicVfcOperation extends BasicHttpOperation {
public static final String POLL_PATH = "my-path-get/";
public static final int MAX_POLLS = 3;
public static final int POLL_WAIT_SEC = 20;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.common.parameters.annotations.Min;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpActorParams;
/**
* Parameters used by Actors that, after issuing an HTTP request, must poll the target
import org.onap.policy.common.parameters.annotations.Min;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
/**
* Parameters used by Operators that, after issuing an HTTP request, must poll the target
* @param listener listener to be executed
*/
protected void runListener(Runnable listener) {
- // TODO do this asynchronously?
Util.runFunction(listener, "pipeline listener {} threw an exception", listener);
}
// with invalid actor parameters
params.setOperations(null);
- assertThatThrownBy(() -> prov.makeOperatorParameters(Util.translateToMap(prov.getName(), params)))
+ Map<String, Object> map = Util.translateToMap(prov.getName(), params);
+ assertThatThrownBy(() -> prov.makeOperatorParameters(map))
.isInstanceOf(ParameterValidationRuntimeException.class);
}
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Before;
import org.junit.Test;
// invalid parameters
params.setSourceTopic(null);
- assertThatThrownBy(() -> oper.configure(Util.translateToMap(OPERATION, params)))
+ Map<String, Object> map = Util.translateToMap(OPERATION, params);
+ assertThatThrownBy(() -> oper.configure(map))
.isInstanceOf(ParameterValidationRuntimeException.class);
}
// with invalid actor parameters
params.setOperations(null);
- assertThatThrownBy(() -> prov.makeOperatorParameters(Util.translateToMap(prov.getName(), params)))
+ Map<String, Object> map = Util.translateToMap(prov.getName(), params);
+ assertThatThrownBy(() -> prov.makeOperatorParameters(map))
.isInstanceOf(ParameterValidationRuntimeException.class);
}
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.aai.util;
-
-public class AaiException extends Exception {
-
- // TODO remove this class
-
- private static final long serialVersionUID = 9220983727706207465L;
-
- public AaiException() {
- super();
- }
-
- public AaiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
-
- public AaiException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AaiException(String message) {
- super(message);
- }
-
- public AaiException(Throwable cause) {
- super(cause);
- }
-
-}
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
public final class Serialization {
- // TODO remove this class
-
public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
private Serialization() {
+++ /dev/null
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.aai.util;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import org.junit.Test;
-
-public class AaiExceptionTest {
-
- private static final String MESSAGE = "message";
-
- @Test
- public void test() {
- assertNotNull(new AaiException());
- assertNotNull(new AaiException(MESSAGE));
- assertNotNull(new AaiException(MESSAGE, new IOException()));
- assertNotNull(new AaiException(MESSAGE, new IOException(), true, false));
- assertNotNull(new AaiException(new IOException()));
- }
-
-}
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.appc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.time.Instant;
import java.util.ArrayList;
copiedCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
copiedCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(commonHeader));
- assertTrue(commonHeader.equals(copiedCommonHeader));
- assertFalse(commonHeader.equals(null));
- assertFalse(commonHeader.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(commonHeader, commonHeader); // NOSONAR
+ assertEquals(commonHeader, copiedCommonHeader);
+ assertNotEquals(commonHeader, null);
+ assertNotEquals(commonHeader, "Hello"); // NOSONAR
CommonHeader clonedCommonHeader = new CommonHeader(commonHeader);
clonedCommonHeader.setApiVer(commonHeader.getApiVer());
clonedCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(clonedCommonHeader));
+ assertEquals(commonHeader, clonedCommonHeader);
commonHeader.setApiVer(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setApiVer(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setApiVer(KANSAS);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setApiVer(KANSAS);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setFlags(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setFlags(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setFlags(flagSet);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setFlags(flagSet);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setOriginatorId(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setOriginatorId(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setOriginatorId(DOROTHY);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setOriginatorId(DOROTHY);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestId(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestId(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestId(requestId);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestId(requestId);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestTrack(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestTrack(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setRequestTrack(requestTrackSet);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setRequestTrack(requestTrackSet);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setSubRequestId(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setSubRequestId(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setTimeStamp(null);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setTimeStamp(null);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
commonHeader.setTimeStamp(timestamp);
- assertFalse(commonHeader.equals(copiedCommonHeader));
+ assertNotEquals(commonHeader, copiedCommonHeader);
copiedCommonHeader.setTimeStamp(timestamp);
- assertTrue(commonHeader.equals(copiedCommonHeader));
+ assertEquals(commonHeader, copiedCommonHeader);
}
}
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
copiedRequest.setPayload(request.getPayload());
copiedRequest.setTargetId(request.getTargetId());
- assertEquals(request, request);
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(request, request); // NOSONAR
assertEquals(request, copiedRequest);
- assertNotEquals(null, request);
- assertNotEquals("Hello", request);
+ assertNotEquals(request, null);
+ assertNotEquals(request, "Hello"); // NOSONAR
request.setCommonHeader(null);
assertNotEquals(request, copiedRequest);
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.appc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
copiedStatus.setDescription(status.getDescription());
copiedStatus.setValue(status.getValue());
- assertTrue(status.equals(status));
- assertTrue(status.equals(copiedStatus));
- assertFalse(status.equals(null));
- assertFalse(status.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(status, status); // NOSONAR
+ assertEquals(status, copiedStatus);
+ assertNotEquals(status, null);
+ assertNotEquals(status, "Hello"); // NOSONAR
status.setCode(-1);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(-1);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setCode(1234);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(1234);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setDescription(null);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setDescription(null);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setDescription(THE_WONDERFUL_LAND_OF_OZ);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setDescription(THE_WONDERFUL_LAND_OF_OZ);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(null);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(null);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(THERE_S_NO_PLACE_LIKE_HOME);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(THERE_S_NO_PLACE_LIKE_HOME);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
}
}
* ============LICENSE_START=======================================================
* appc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.appc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
copiedResponse.setStatus(response.getStatus());
copiedResponse.setPayload(response.getPayload());
- assertTrue(response.equals(response));
- assertTrue(response.equals(copiedResponse));
- assertFalse(response.equals(null));
- assertFalse(response.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(response, response); // NOSONAR
+ assertEquals(response, copiedResponse);
+ assertNotEquals(response, null);
+ assertNotEquals(response, "Hello"); // NOSONAR
response.setCommonHeader(null);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setCommonHeader(null);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setCommonHeader(commonHeader);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setCommonHeader(commonHeader);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setStatus(null);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setStatus(null);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setStatus(status);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setStatus(status);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setPayload(new HashMap<String, Object>());
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setPayload(new HashMap<String, Object>());
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
response.setPayload(payload);
- assertFalse(response.equals(copiedResponse));
+ assertNotEquals(response, copiedResponse);
copiedResponse.setPayload(payload);
- assertTrue(response.equals(copiedResponse));
+ assertEquals(response, copiedResponse);
}
}
import org.slf4j.LoggerFactory;
public class CdsProcessorHandler {
-
private static final Logger LOGGER = LoggerFactory.getLogger(CdsProcessorHandler.class);
+ private static final String LOG_MSG = "[{}|{}|{}|]{}{}";
private CdsProcessorListener listener;
private String url;
final StreamObserver<ExecutionServiceOutput> responseObserver = new StreamObserver<ExecutionServiceOutput>() {
@Override
public void onNext(ExecutionServiceOutput output) {
- LOGGER.info("[{}|{}|{}|]{}{}", EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
- output.toString());
+ LOGGER.info(LOG_MSG, EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
+ output);
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, output.toString());
listener.onMessage(output);
@Override
public void onError(Throwable throwable) {
- LOGGER.info("[{}|{}|{}|]{}{}", EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
- throwable.toString());
+ LOGGER.info(LOG_MSG, EventType.IN, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
+ throwable);
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, throwable.toString());
listener.onError(throwable);
finishLatch.countDown();
final StreamObserver<ExecutionServiceInput> requestObserver = asyncStub.process(responseObserver);
try {
- LOGGER.info("[{}|{}|{}|]{}{}", EventType.OUT, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
- request.toString());
+ LOGGER.info(LOG_MSG, EventType.OUT, CommInfrastructure.REST, url, NetLoggerUtil.SYSTEM_LS,
+ request);
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, request.toString());
// Send the message to CDS backend for processing
* ============LICENSE_START=======================================================
* controlloop
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
public void test() {
ControlLoopOperation operation = new ControlLoopOperation();
- assertEquals(operation, operation);
- assertNotEquals(operation, new String());
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(operation, operation); // NOSONAR
+ assertNotEquals(operation, ""); // NOSONAR
assertNotEquals(operation, null);
- assertTrue(operation.hashCode() != 0);
+ assertNotEquals(0, operation.hashCode());
assertTrue(operation.toString().startsWith("ControlLoopOperation"));
assertNotNull(operation);
operation.setTarget("target");
assertEquals("target", operation.getTarget());
- assertTrue(operation.hashCode() != 0);
+ assertNotEquals(0, operation.hashCode());
ControlLoopOperation operation2 = new ControlLoopOperation(operation);
assertEquals(now, operation2.getEnd());
package org.onap.policy.guard;
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 java.util.Date;
int hc = dao.hashCode();
dao.setId(101L);
- assertTrue(hc != dao.hashCode());
+ assertNotEquals(hc, dao.hashCode());
- assertTrue(dao.equals(dao));
- assertFalse(dao.equals(new OperationsHistory()));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(dao, dao); // NOSONAR
+ assertNotEquals(dao, new OperationsHistory());
}
}
* ============LICENSE_START=======================================================
* rest
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.rest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.annotation.Documented;
Pair<Integer, String> result = mgr.get(getUri, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, null, null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.put(putUri, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.put(putUriBlank, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.post(postUri, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.post(postUriBlank, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.patch(patchUri, null, null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.patch(patchUriBlank, null, null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING, result.getRight());
Pair<Integer, String> result = mgr.get(getUri, "", null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, "", null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.put(putUri, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.put(putUriBlank, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.post(postUri, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.post(postUriBlank, "", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.patch(patchUri, "", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.patch(patchUriBlank, "", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING, result.getRight());
Pair<Integer, String> result = mgr.get(getUri, "user", null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + EXPECT_STRING, result.getRight());
result = mgr.delete(deleteUri, "user", null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + EXPECT_STRING, result.getRight());
result = mgr.put(putUri, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.put(putUriBlank, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.post(postUri, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.post(postUriBlank, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING, result.getRight());
result = mgr.patch(patchUri, "user", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + EXPECT_STRING, result.getRight());
result = mgr.patch(patchUriBlank, "user", null, null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING, result.getRight());
Pair<Integer, String> result = mgr.get(baseUri + "RestTest/GetHello/" + NAME_PARAM, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("GOT: " + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.delete(baseUri + "RestTest/DeleteHello/" + NAME_PARAM, null, null, null, null, null);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("DELETE: " + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.put(baseUri + "RestTest/PutHello/" + NAME_PARAM, null, null, null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PUT: " + PAYLOAD + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.post(baseUri + "RestTest/PostHello/" + NAME_PARAM, null, null,
null, MediaType.TEXT_PLAIN, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("POST: " + PAYLOAD + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
result = mgr.patch(baseUri + "RestTest/PatchHello/" + NAME_PARAM, null, null,
null, PAYLOAD);
assertEquals((Integer) 200, result.getLeft());
- assertTrue(result.getRight() != null);
+ assertNotNull(result.getRight());
assertTrue(result.getRight().length() > 0);
assertEquals("PATCH: " + PAYLOAD + RETURN_STRING + NAME_PARAM + " aged 90", result.getRight());
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
public void testEquals() {
ResourceInstance ri1 = new ResourceInstance();
ResourceInstance ri2 = new ResourceInstance(ri1);
- assertTrue(ri1.equals(ri2));
- assertTrue(ri2.equals(ri1));
+ assertEquals(ri1, ri2);
+ assertEquals(ri2, ri1);
ri1.setResourceInstanceName(INSTANCE);
ri1.setResourceName(RESOURCE);
ri1.setResourceVersion(VERSION_000);
ri1.setResourceType(ResourceType.VL);
ri2 = new ResourceInstance(ri1);
- assertTrue(ri1.equals(ri2));
- assertTrue(ri2.equals(ri1));
+ assertEquals(ri1, ri2);
+ assertEquals(ri2, ri1);
}
@Test
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
public void testEquals() {
Resource r1 = new Resource();
Resource r2 = new Resource(r1);
- assertTrue(r1.equals(r2));
- assertTrue(r2.equals(r1));
+ assertEquals(r1, r2);
+ assertEquals(r2, r1);
r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111,
ResourceType.VFC);
r2 = new Resource(r1);
- assertTrue(r1.equals(r2));
- assertTrue(r2.equals(r1));
+ assertEquals(r1, r2);
+ assertEquals(r2, r1);
}
@Test
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
public void testEquals() {
ServiceInstance si1 = new ServiceInstance();
ServiceInstance si2 = new ServiceInstance(si1);
- assertTrue(si1.equals(si2));
- assertTrue(si2.equals(si1));
+ assertEquals(si1, si2);
+ assertEquals(si2, si1);
si1.setServiceInstanceName(INSTANCE);
si1.setServiceName(SERVICE);
si1.setWidgetModelUUID(UUID.randomUUID());
si1.setWidgetModelVersion(VERSION_333);
si2 = new ServiceInstance(si1);
- assertTrue(si1.equals(si2));
- assertTrue(si2.equals(si1));
+ assertEquals(si1, si2);
+ assertEquals(si2, si1);
}
@Test
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.sdc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.util.UUID;
import org.junit.Test;
public void testEquals() {
Service s1 = new Service();
Service s2 = new Service(s1);
- assertTrue(s1.equals(s2));
- assertTrue(s2.equals(s1));
+ assertEquals(s1, s2);
+ assertEquals(s2, s1);
s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), EQUALS_TEST, VERSION_111);
s2 = new Service(s1);
- assertTrue(s1.equals(s2));
- assertTrue(s2.equals(s1));
+ assertEquals(s1, s2);
+ assertEquals(s2, s1);
}
@Test
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.time.Instant;
import java.util.HashMap;
copiedPciCommonHeader.setSubRequestId(commonHeader.getSubRequestId());
copiedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(commonHeader));
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
- assertFalse(commonHeader.equals(null));
- assertFalse(commonHeader.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(commonHeader, commonHeader); // NOSONAR
+ assertEquals(commonHeader, copiedPciCommonHeader);
+ assertNotEquals(commonHeader, null);
+ assertNotEquals(commonHeader, "Hello"); // NOSONAR
PciCommonHeader clonedPciCommonHeader = new PciCommonHeader(commonHeader);
clonedPciCommonHeader.setApiVer(commonHeader.getApiVer());
clonedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp());
- assertTrue(commonHeader.equals(clonedPciCommonHeader));
+ assertEquals(commonHeader, clonedPciCommonHeader);
commonHeader.setApiVer(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setApiVer(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setApiVer(KANSAS);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setApiVer(KANSAS);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setFlags(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setFlags(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setFlags(flagMap);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setFlags(flagMap);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestTrack(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestTrack(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestTrack(requestMap);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestTrack(requestMap);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestId(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestId(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setRequestId(requestId);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setRequestId(requestId);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setSubRequestId(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setSubRequestId(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setSubRequestId(CAN_I_GO_HOME);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setTimeStamp(null);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setTimeStamp(null);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
commonHeader.setTimeStamp(timestamp);
- assertFalse(commonHeader.equals(copiedPciCommonHeader));
+ assertNotEquals(commonHeader, copiedPciCommonHeader);
copiedPciCommonHeader.setTimeStamp(timestamp);
- assertTrue(commonHeader.equals(copiedPciCommonHeader));
+ assertEquals(commonHeader, copiedPciCommonHeader);
}
}
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
copiedPciRequest.setAction(request.getAction());
copiedPciRequest.setPayload(request.getPayload());
- assertTrue(request.equals(request));
- assertTrue(request.equals(copiedPciRequest));
- assertFalse(request.equals(null));
- assertFalse(request.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(request, request); // NOSONAR
+ assertEquals(request, copiedPciRequest);
+ assertNotEquals(request, null);
+ assertNotEquals(request, "Hello"); // NOSONAR
request.setCommonHeader(null);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setCommonHeader(null);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setCommonHeader(commonHeader);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setCommonHeader(commonHeader);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setAction(null);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setAction(null);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setAction(MODIFY);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setAction(MODIFY);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setPayload(null);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setPayload(null);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
request.setPayload(requestPayload);
- assertFalse(request.equals(copiedPciRequest));
+ assertNotEquals(request, copiedPciRequest);
copiedPciRequest.setPayload(requestPayload);
- assertTrue(request.equals(copiedPciRequest));
+ assertEquals(request, copiedPciRequest);
}
}
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 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.
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
PciRequestWrapper copiedPciRequestWrapper = new PciRequestWrapper();
copiedPciRequestWrapper.setBody(requestWrapper.getBody());
- assertTrue(requestWrapper.equals(requestWrapper));
- assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
- assertFalse(requestWrapper.equals(null));
- assertFalse(requestWrapper.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(requestWrapper, requestWrapper); // NOSONAR
+ assertEquals(requestWrapper, copiedPciRequestWrapper);
+ assertNotEquals(requestWrapper, null);
+ assertNotEquals(requestWrapper, "Hello"); // NOSONAR
requestWrapper.setBody(null);
- assertFalse(requestWrapper.equals(copiedPciRequestWrapper));
+ assertNotEquals(requestWrapper, copiedPciRequestWrapper);
copiedPciRequestWrapper.setBody(null);
- assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ assertEquals(requestWrapper, copiedPciRequestWrapper);
requestWrapper.setBody(request);
- assertFalse(requestWrapper.equals(copiedPciRequestWrapper));
+ assertNotEquals(requestWrapper, copiedPciRequestWrapper);
copiedPciRequestWrapper.setBody(request);
- assertTrue(requestWrapper.equals(copiedPciRequestWrapper));
+ assertEquals(requestWrapper, copiedPciRequestWrapper);
}
}
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
package org.onap.policy.sdnr;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
@Test
public void testHashCode() {
PciResponse response = new PciResponse();
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
response.setCommonHeader(new PciCommonHeader());
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
response.setPayload(responsePayload);
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
response.setStatus(null);
- assertTrue(response.hashCode() != 0);
+ assertNotEquals(0, response.hashCode());
}
@Test
@Test
public void testEqualsObject() {
PciResponse response = new PciResponse();
- assertTrue(response.equals(response));
- assertFalse(response.equals(null));
- assertFalse(response.equals(new Object()));
+ assertEquals(response, response);
+ assertNotEquals(response, null);
+ assertNotEquals(response, new Object());
PciResponse response2 = new PciResponse();
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setCommonHeader(new PciCommonHeader());
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setCommonHeader(response.getCommonHeader());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setPayload(responsePayload);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setPayload(response.getPayload());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setCommonHeader(null);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setCommonHeader(null);
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setPayload(null);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setPayload(response.getPayload());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
response.setStatus(null);
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
response2.setStatus(response.getStatus());
- assertTrue(response.equals(response2));
+ assertEquals(response, response2);
Status stat = new Status();
stat.setCode(5);
response.setStatus(stat);
response2.setStatus(new Status());
- assertFalse(response.equals(response2));
+ assertNotEquals(response, response2);
}
@Test
PciResponse response = new PciResponse(request);
- assertTrue(response.getCommonHeader().equals(request.getCommonHeader()));
+ assertEquals(response.getCommonHeader(), request.getCommonHeader());
}
}
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2020 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.
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
PciResponseWrapper copiedPciResponseWrapper = new PciResponseWrapper();
copiedPciResponseWrapper.setBody(responseWrapper.getBody());
- assertTrue(responseWrapper.equals(responseWrapper));
- //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
- assertFalse(responseWrapper.equals(null));
- assertFalse(responseWrapper.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(responseWrapper, responseWrapper); // NOSONAR
+ //assertEquals(responseWrapper, copiedPciResponseWrapper);
+ assertNotEquals(responseWrapper, null);
+ assertNotEquals(responseWrapper, "Hello"); // NOSONAR
responseWrapper.setBody(null);
- assertFalse(responseWrapper.equals(copiedPciResponseWrapper));
+ assertNotEquals(responseWrapper, copiedPciResponseWrapper);
copiedPciResponseWrapper.setBody(null);
- //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ //assertEquals(responseWrapper, copiedPciResponseWrapper);
responseWrapper.setBody(response);
- //assertFalse(responseWrapper.equals(copiedPciResponseWrapper));
+ //assertNotEquals(responseWrapper, copiedPciResponseWrapper);
copiedPciResponseWrapper.setBody(response);
- //assertTrue(responseWrapper.equals(copiedPciResponseWrapper));
+ //assertEquals(responseWrapper, copiedPciResponseWrapper);
}
}
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
copiedStatus.setCode(status.getCode());
copiedStatus.setValue(status.getValue());
- assertTrue(status.equals(status));
- assertTrue(status.equals(copiedStatus));
- assertFalse(status.equals(null));
- assertFalse(status.equals("Hello"));
+ /*
+ * Disabling sonar to test equals().
+ */
+ assertEquals(status, status); // NOSONAR
+ assertEquals(status, copiedStatus);
+ assertNotEquals(status, null);
+ assertNotEquals(status, "Hello"); // NOSONAR
status.setCode(-1);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(-1);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setCode(1234);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setCode(1234);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(null);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(null);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
status.setValue(THE_WONDERFUL_LAND_OF_OZ);
- assertFalse(status.equals(copiedStatus));
+ assertNotEquals(status, copiedStatus);
copiedStatus.setValue(THE_WONDERFUL_LAND_OF_OZ);
- assertTrue(status.equals(copiedStatus));
+ assertEquals(status, copiedStatus);
}
}
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
package org.onap.policy.sdnr;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
copiedPciWrapper.setCorrelationId(wrapper.getCorrelationId());
copiedPciWrapper.setType(wrapper.getType());
- assertTrue(wrapper.equals(wrapper));
- assertTrue(wrapper.equals(copiedPciWrapper));
- assertFalse(wrapper.equals(null));
- assertFalse(wrapper.equals("Hello"));
+ assertEquals(wrapper, wrapper);
+ assertEquals(wrapper, copiedPciWrapper);
+ assertNotEquals(wrapper, null);
+ assertNotEquals(wrapper, "Hello");
wrapper.setVersion(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setVersion(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setVersion(VERSION_19);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setVersion(VERSION_19);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCambriaPartition(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCambriaPartition(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCambriaPartition(THE_EMERALD_CITY);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCambriaPartition(THE_EMERALD_CITY);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setRpcName(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setRpcName(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setRpcName(TORNADO);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setRpcName(TORNADO);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCorrelationId(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCorrelationId(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setCorrelationId(YELLOW_BRICK_ROAD);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setCorrelationId(YELLOW_BRICK_ROAD);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setType(null);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setType(null);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
wrapper.setType(MUNCHKIN);
- assertFalse(wrapper.equals(copiedPciWrapper));
+ assertNotEquals(wrapper, copiedPciWrapper);
copiedPciWrapper.setType(MUNCHKIN);
- assertTrue(wrapper.equals(copiedPciWrapper));
+ assertEquals(wrapper, copiedPciWrapper);
}
}
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import java.time.LocalDateTime;
import org.junit.Test;
public void testConstructor() {
SoAsyncRequestStatus obj = new SoAsyncRequestStatus();
- assertTrue(obj.getCorrelator() == null);
- assertTrue(obj.getFinishTime() == null);
- assertTrue(obj.getInstanceReferences() == null);
- assertTrue(obj.getRequestId() == null);
- assertTrue(obj.getRequestScope() == null);
- assertTrue(obj.getRequestStatus() == null);
- assertTrue(obj.getStartTime() == null);
+ assertNull(obj.getCorrelator());
+ assertNull(obj.getFinishTime());
+ assertNull(obj.getInstanceReferences());
+ assertNull(obj.getRequestId());
+ assertNull(obj.getRequestScope());
+ assertNull(obj.getRequestStatus());
+ assertNull(obj.getStartTime());
}
@Test
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoCloudConfiguration obj = new SoCloudConfiguration();
- assertTrue(obj.getLcpCloudRegionId() == null);
- assertTrue(obj.getTenantId() == null);
+ assertNull(obj.getLcpCloudRegionId());
+ assertNull(obj.getTenantId());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoInstanceReferences obj = new SoInstanceReferences();
- assertTrue(obj.getInstanceId() == null);
- assertTrue(obj.getRequestId() == null);
+ assertNull(obj.getInstanceId());
+ assertNull(obj.getRequestId());
}
@Test
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoModelInfo obj = new SoModelInfo();
- assertTrue(obj.getModelCustomizationId() == null);
- assertTrue(obj.getModelCustomizationName() == null);
- assertTrue(obj.getModelInvariantId() == null);
- assertTrue(obj.getModelName() == null);
- assertTrue(obj.getModelType() == null);
- assertTrue(obj.getModelVersion() == null);
- assertTrue(obj.getModelVersionId() == null);
+ assertNull(obj.getModelCustomizationId());
+ assertNull(obj.getModelCustomizationName());
+ assertNull(obj.getModelInvariantId());
+ assertNull(obj.getModelName());
+ assertNull(obj.getModelType());
+ assertNull(obj.getModelVersion());
+ assertNull(obj.getModelVersionId());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder();
- assertTrue(obj.getMessageId() == null);
- assertTrue(obj.getText() == null);
+ assertNull(obj.getMessageId());
+ assertNull(obj.getText());
}
@Test
* so
* ================================================================================
*
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement();
- assertTrue(obj.getRelatedInstance() == null);
+ assertNull(obj.getRelatedInstance());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoRelatedInstance obj = new SoRelatedInstance();
- assertTrue(obj.getInstanceId() == null);
- assertTrue(obj.getInstanceName() == null);
- assertTrue(obj.getModelInfo() == null);
+ assertNull(obj.getInstanceId());
+ assertNull(obj.getInstanceName());
+ assertNull(obj.getModelInfo());
}
@Test
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
public void testConstructor() {
SoRequestDetails obj = new SoRequestDetails();
- assertTrue(obj.getCloudConfiguration() == null);
- assertTrue(obj.getModelInfo() == null);
- assertTrue(obj.getRequestInfo() == null);
- assertTrue(obj.getRequestParameters() == null);
- assertTrue(obj.getSubscriberInfo() == null);
+ assertNull(obj.getCloudConfiguration());
+ assertNull(obj.getModelInfo());
+ assertNull(obj.getRequestInfo());
+ assertNull(obj.getRequestParameters());
+ assertNull(obj.getSubscriberInfo());
- assertTrue(obj.getRelatedInstanceList() != null);
+ assertNotNull(obj.getRelatedInstanceList());
assertEquals(0, obj.getRelatedInstanceList().size());
}
obj.setSubscriberInfo(subscriberInfo);
assertEquals(subscriberInfo, obj.getSubscriberInfo());
}
-
+
@Test
public void testSoMRequestDetailsMethods() {
SoRequestDetails details = new SoRequestDetails();
assertTrue(details.equals(copiedDetails));
assertFalse(details.equals(null));
assertFalse(details.equals("Hello"));
-
+
details.setCloudConfiguration(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setCloudConfiguration(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setModelInfo(modelInfo);
assertTrue(details.equals(copiedDetails));
-
+
details.setRequestInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestInfo(null);
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoRequestError obj = new SoRequestError();
- assertTrue(obj.getPolicyException() == null);
- assertTrue(obj.getServiceException() == null);
+ assertNull(obj.getPolicyException());
+ assertNull(obj.getServiceException());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoRequestParameters obj = new SoRequestParameters();
- assertTrue(obj.getSubscriptionServiceType() == null);
- assertTrue(obj.getUserParams() != null);
+ assertNull(obj.getSubscriptionServiceType());
+ assertNotNull(obj.getUserParams());
assertEquals(0, obj.getUserParams().size());
}
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoRequestReferences obj = new SoRequestReferences();
- assertTrue(obj.getInstanceId() == null);
- assertTrue(obj.getRequestId() == null);
+ assertNull(obj.getInstanceId());
+ assertNull(obj.getRequestId());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
SoRequestStatus obj = new SoRequestStatus();
assertEquals(0, obj.getPercentProgress());
- assertTrue(obj.getRequestState() == null);
- assertTrue(obj.getTimestamp() == null);
+ assertNull(obj.getRequestState());
+ assertNull(obj.getTimestamp());
assertFalse(obj.isWasRolledBack());
}
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import java.time.LocalDateTime;
import java.util.UUID;
public void testConstructor() {
SoRequest obj = new SoRequest();
- assertTrue(obj.getFinishTime() == null);
- assertTrue(obj.getRequestDetails() == null);
- assertTrue(obj.getRequestId() == null);
- assertTrue(obj.getRequestScope() == null);
- assertTrue(obj.getRequestStatus() == null);
- assertTrue(obj.getRequestType() == null);
- assertTrue(obj.getStartTime() == null);
+ assertNull(obj.getFinishTime());
+ assertNull(obj.getRequestDetails());
+ assertNull(obj.getRequestId());
+ assertNull(obj.getRequestScope());
+ assertNull(obj.getRequestStatus());
+ assertNull(obj.getRequestType());
+ assertNull(obj.getStartTime());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
SoResponse obj = new SoResponse();
assertEquals(0, obj.getHttpResponseCode());
- assertTrue(obj.getRequest() == null);
- assertTrue(obj.getRequestError() == null);
- assertTrue(obj.getRequestReferences() == null);
+ assertNull(obj.getRequest());
+ assertNull(obj.getRequestError());
+ assertNull(obj.getRequestReferences());
}
@Test
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId);
- assertEquals(responseWrapper, responseWrapper);
+ /*
+ * Disabling sonar because we are purposely checking various branches of the
+ * equals() method.
+ */
+ assertEquals(responseWrapper, responseWrapper); // NOSONAR
assertEquals(responseWrapper, identicalResponseWrapper);
assertNotEquals(null, responseWrapper);
- assertNotEquals("Hello", responseWrapper);
- assertFalse(responseWrapper.equals(null));
- assertFalse(responseWrapper.equals("AString"));
+ assertNotEquals("Hello", responseWrapper); // NOSONAR
+ assertNotEquals(responseWrapper, null);
+ assertNotEquals(responseWrapper, "AString"); // NOSONAR
assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null));
assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper);
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoServiceExceptionHolder obj = new SoServiceExceptionHolder();
- assertTrue(obj.getMessageId() == null);
- assertTrue(obj.getText() == null);
- assertTrue(obj.getVariables() != null);
+ assertNull(obj.getMessageId());
+ assertNull(obj.getText());
+ assertNotNull(obj.getVariables());
assertEquals(0, obj.getVariables().size());
}
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public void testConstructor() {
SoSubscriberInfo obj = new SoSubscriberInfo();
- assertTrue(obj.getGlobalSubscriberId() == null);
- assertTrue(obj.getSubscriberCommonSiteId() == null);
- assertTrue(obj.getSubscriberName() == null);
+ assertNull(obj.getGlobalSubscriberId());
+ assertNull(obj.getSubscriberCommonSiteId());
+ assertNull(obj.getSubscriberName());
}
@Test
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
final AaiCqResponse response = new AaiManager(new RestManager()).getCustomQueryResponse("http://localhost:6666",
"testUser", "testPass", UUID.randomUUID(), "f953c499-4b1e-426b-8c6d-e9e9f1fc730f");
assertNotNull(response);
- assertEquals(response.getVserver().getVserverId(), "f953c499-4b1e-426b-8c6d-e9e9f1fc730f");
+ assertEquals("f953c499-4b1e-426b-8c6d-e9e9f1fc730f", response.getVserver().getVserverId());
}
}
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
package org.onap.policy.simulators;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
new RestManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password",
new HashMap<String, String>(), "application/json", "Some Request Here");
assertNotNull(httpDetails);
- assertTrue(httpDetails.getLeft() == 202);
+ assertEquals(202, httpDetails.getLeft().intValue());
final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class);
assertNotNull(response);
}
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
assertEquals(hash, group.hashCode());
group.setName("B");
- assertTrue(hash != group.hashCode());
+ assertNotEquals(hash, group.hashCode());
}
@Test
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
assertEquals(hash, group.hashCode());
group.setDescription("B");
- assertTrue(hash != group.hashCode());
+ assertNotEquals(hash, group.hashCode());
}
@Test
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotSame;
import static org.onap.policy.models.pdp.concepts.PdpMessageUtils.removeVariableFields;
import java.util.Arrays;
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
// ensure list and items are not the same object
- assertTrue(other.getPolicies() != policies);
- assertTrue(other.getPolicies().get(0) != policies.get(0));
+ assertNotSame(other.getPolicies(), policies);
+ assertNotSame(other.getPolicies().get(0), policies.get(0));
}
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
assertEquals(0, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
assertEquals(-1, testJpaPdpGroup.compareTo(null));
assertEquals(0, testJpaPdpGroup.compareTo(testJpaPdpGroup));
- assertFalse(testJpaPdpGroup.compareTo(new DummyJpaPdpSubgroupChild()) == 0);
+ assertNotEquals(0, testJpaPdpGroup.compareTo(new DummyJpaPdpSubgroupChild()));
testJpaPdpGroup.getKey().setName("OtherName");
assertEquals(-1, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
assertEquals(0, testJpaPdpSubGroup.compareTo(otherJpaPdpSubGroup));
assertEquals(-1, testJpaPdpSubGroup.compareTo(null));
assertEquals(0, testJpaPdpSubGroup.compareTo(testJpaPdpSubGroup));
- assertFalse(testJpaPdpSubGroup.compareTo(new DummyJpaPdpSubgroupChild()) == 0);
+ assertNotEquals(0, testJpaPdpSubGroup.compareTo(new DummyJpaPdpSubgroupChild()));
testJpaPdpSubGroup.getKey().setParentKeyName("Parent1");
assertEquals(1, testJpaPdpSubGroup.compareTo(otherJpaPdpSubGroup));
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 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.
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
assertEquals(0, testJpaPdp.compareTo(otherJpaPdp));
assertEquals(-1, testJpaPdp.compareTo(null));
assertEquals(0, testJpaPdp.compareTo(testJpaPdp));
- assertFalse(testJpaPdp.compareTo(new DummyJpaPdpChild()) == 0);
+ assertNotEquals(0, testJpaPdp.compareTo(new DummyJpaPdpChild()));
testJpaPdp.getKey().setParentLocalName("ParentLocal1");
assertEquals(1, testJpaPdp.compareTo(otherJpaPdp));
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
public void testMain_NoArguments() {
final String[] NormalParameters = {};
main = new Main(NormalParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
// note: this is missing the "-c" argument, thus the ARGUMENTS are invalid
final String[] NormalParameters = {"parameters/NormalParameters.json"};
main = new Main(NormalParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
public void testMain_InvalidParameters() {
final String[] NormalParameters = {"-c", "parameters/InvalidParameters.json"};
main = new Main(NormalParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
}
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.After;
public void testPdpSimulator_NoArguments() {
final String[] pdpSimulatorConfigParameters = {};
pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters);
- assertTrue(pdpSimulator.getParameters() == null);
+ assertNull(pdpSimulator.getParameters());
}
@Test
public void testPdpSimulator_InvalidArguments() {
final String[] pdpSimulatorConfigParameters = { "src/test/resourcesPdpSimulatorConfigParameters.json" };
pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters);
- assertTrue(pdpSimulator.getParameters() == null);
+ assertNull(pdpSimulator.getParameters());
}
@Test
final String[] pdpSimulatorConfigParameters =
{ "-c", "src/test/resources/PdpSimulatorConfigParameters_InvalidName.json" };
pdpSimulator = new PdpSimulatorMain(pdpSimulatorConfigParameters);
- assertTrue(pdpSimulator.getParameters() == null);
+ assertNull(pdpSimulator.getParameters());
}
}