<!--
============LICENSE_START=======================================================
- Copyright (C) 2019 Nordix Foundation.
+ Copyright (C) 2019,2023 Nordix Foundation.
Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* ONAP
* ================================================================================
* Copyright (C) 2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.sdnr.util.StatusCodeEnum;
+@RunWith(MockitoJUnitRunner.class)
public class A1pOperationTest extends BasicA1pOperation {
private A1pOperation operation;
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
+@RunWith(MockitoJUnitRunner.class)
public class AaiCustomQueryOperationTest extends BasicAaiOperation {
private static final StandardCoder coder = new StandardCoder();
public void testStartOperationAsync_testMakeRequest() throws Exception {
// need two responses
when(rawResponse.readEntity(String.class)).thenReturn(makeTenantReply()).thenReturn(makeCqReply());
- when(webAsync.get(any(InvocationCallback.class))).thenAnswer(provideResponse(rawResponse));
+ lenient().when(webAsync.get(any(InvocationCallback.class))).thenAnswer(provideResponse(rawResponse));
when(webAsync.put(any(), any(InvocationCallback.class))).thenAnswer(provideResponse(rawResponse, 1));
CompletableFuture<OperationOutcome> future2 = oper.start();
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.aai.AaiConstants;
+@RunWith(MockitoJUnitRunner.class)
public class AaiGetOperationTest extends BasicAaiOperation {
private static final String MY_NAME = "my-operation-name";
private static final String PARAM_NAME = "my-param";
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
+@RunWith(MockitoJUnitRunner.class)
public class AaiGetPnfOperationTest extends BasicAaiOperation {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
+@RunWith(MockitoJUnitRunner.class)
public class AaiGetTenantOperationTest extends BasicAaiOperation {
private static final String INPUT_FIELD = "input";
private static final String TEXT = "my-text";
<!--
============LICENSE_START=======================================================
Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* ONAP
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Arrays;
import java.util.stream.Collectors;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.actor.test.BasicActor;
+@RunWith(MockitoJUnitRunner.class)
public class AppcActorTest extends BasicActor {
@Test
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
+@RunWith(MockitoJUnitRunner.class)
public class AppcOperationTest extends BasicAppcOperation {
private AppcOperation oper;
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams;
+@RunWith(MockitoJUnitRunner.class)
public class ModifyConfigOperationTest extends BasicAppcOperation {
private ModifyConfigOperation oper;
<!--
============LICENSE_START=======================================================
Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>model-actors</artifactId>
- <version>2.8.1-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
+ <artifactId>model-actors</artifactId>
+ <version>2.8.1-SNAPSHOT</version>
+ </parent>
- <artifactId>actor.appclcm</artifactId>
+ <artifactId>actor.appclcm</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>actorServiceProvider</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>appclcm</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>actor.appc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>events</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>policy-endpoints</artifactId>
- <version>${policy.common.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
- <artifactId>actor.test</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions</groupId>
- <artifactId>simulators</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
+ <artifactId>actorServiceProvider</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>appclcm</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>aai</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
+ <artifactId>actor.appc</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>events</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>policy-endpoints</artifactId>
+ <version>${policy.common.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId>
+ <artifactId>actor.test</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions</groupId>
+ <artifactId>simulators</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.simulators.AppcLcmTopicServer;
import org.onap.policy.simulators.TopicServer;
+@RunWith(MockitoJUnitRunner.class)
public class AppcLcmOperationTest extends BasicBidirectionalTopicOperation<AppcLcmDmaapWrapper> {
private static final String EXPECTED_EXCEPTION = "expected exception";
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.sdnc.SdncResponse;
+@RunWith(MockitoJUnitRunner.class)
public class BandwidthOnDemandOperationTest extends BasicSdncOperation {
private static final String MY_SERVICE = "my-service";
private static final String MY_VNF = "my-vnf";
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpParams;
import org.onap.policy.sdnc.SdncResponse;
+@RunWith(MockitoJUnitRunner.class)
public class RerouteOperationTest extends BasicSdncOperation {
private static final String MY_SERVICE = "my-service";
private static final String MY_NETWORK = "my-network";
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.sdnc.SdncHealRequest;
import org.onap.policy.sdnc.SdncHealRequestHeaderInfo;
import org.onap.policy.sdnc.SdncRequest;
+@RunWith(MockitoJUnitRunner.class)
public class SdncOperationTest extends BasicSdncOperation {
private static final String MY_URI = "my-uri";
/**
* Sets up.
*/
+ @Override
@Before
public void setUp() throws Exception {
super.setUp();
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020,2023 Nordix Foundation.
Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* SdnrOperation
* ================================================================================
* Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.sdnr.PciRequest;
import org.onap.policy.sdnr.util.StatusCodeEnum;
+@RunWith(MockitoJUnitRunner.class)
public class SdnrOperationTest extends BasicSdnrOperation {
private SdnrOperation operation;
<!--
============LICENSE_START=======================================================
Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.controlloop.actor.so;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.lenient;
import java.util.Collections;
import java.util.HashMap;
response.setRequestReferences(ref);
ref.setRequestId(REQ_ID.toString());
- when(rawResponse.getStatus()).thenReturn(200);
- when(rawResponse.readEntity(String.class)).thenReturn(coder.encode(response));
+ lenient().when(rawResponse.getStatus()).thenReturn(200);
+ lenient().when(rawResponse.readEntity(String.class)).thenReturn(coder.encode(response));
initConfig();
}
@Override
protected void initConfig() {
super.initConfig();
- when(config.getClient()).thenReturn(client);
- when(config.getPath()).thenReturn(MY_PATH);
- when(config.getMaxPolls()).thenReturn(MAX_POLLS);
- when(config.getPollPath()).thenReturn(POLL_PATH);
- when(config.getPollWaitSec()).thenReturn(POLL_WAIT_SEC);
+ lenient().when(config.getClient()).thenReturn(client);
+ lenient().when(config.getPath()).thenReturn(MY_PATH);
+ lenient().when(config.getMaxPolls()).thenReturn(MAX_POLLS);
+ lenient().when(config.getPollPath()).thenReturn(POLL_PATH);
+ lenient().when(config.getPollWaitSec()).thenReturn(POLL_WAIT_SEC);
}
@Override
* ONAP
* ================================================================================
* Copyright (C) 2022 CTC, Inc. and others. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
import org.onap.policy.so.SoResponse;
+@RunWith(MockitoJUnitRunner.class)
public class ModifyCllTest extends BasicSoOperation {
private ModifyCll oper;
* ================================================================================
* Copyright (C) 2020 Wipro Limited.
* Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingParams;
import org.onap.policy.so.SoResponse;
+@RunWith(MockitoJUnitRunner.class)
public class ModifyNssiTest extends BasicSoOperation {
private ModifyNssi oper;
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Wipro Limited.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.lenient;
import java.time.LocalDateTime;
import java.time.Month;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Tenant;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.so.SoRequestStatus;
import org.onap.policy.so.SoResponse;
+@RunWith(MockitoJUnitRunner.class)
public class SoOperationTest extends BasicSoOperation {
private static final List<String> PROP_NAMES = Collections.emptyList();
assertTrue(oper.isSuccess(rawResponse, response));
- when(rawResponse.getStatus()).thenReturn(500);
+ lenient().when(rawResponse.getStatus()).thenReturn(500);
assertTrue(oper.isSuccess(rawResponse, response));
}
@Test
public void testSetOutcome() {
// success case
- when(rawResponse.getStatus()).thenReturn(200);
+ lenient().when(rawResponse.getStatus()).thenReturn(200);
assertSame(outcome, oper.setOutcome(outcome, OperationResult.SUCCESS, rawResponse, response));
assertEquals(OperationResult.SUCCESS, outcome.getResult());
assertSame(response, outcome.getResponse());
// failure case
- when(rawResponse.getStatus()).thenReturn(500);
+ lenient().when(rawResponse.getStatus()).thenReturn(500);
assertSame(outcome, oper.setOutcome(outcome, OperationResult.FAILURE, rawResponse, response));
assertEquals(OperationResult.FAILURE, outcome.getResult());
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Wipro Limited.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ModelVer;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponse;
+@RunWith(MockitoJUnitRunner.class)
public class VfModuleCreateTest extends BasicSoOperation {
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Wipro Limited.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponse;
+@RunWith(MockitoJUnitRunner.class)
public class VfModuleDeleteTest extends BasicSoOperation {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String SVC_INSTANCE_ID = "my-service-instance-id";
// indicate that the response was incomplete
configureResponse(coder.encode(response).replace("COMPLETE", "incomplete"));
- when(rawResponse.getStatus()).thenReturn(500, 500, 500, 200, 200);
- when(client.get(any(), any(), any())).thenAnswer(provideResponse(rawResponse));
+ lenient().when(rawResponse.getStatus()).thenReturn(500, 500, 500, 200, 200);
+ lenient().when(client.get(any(), any(), any())).thenAnswer(provideResponse(rawResponse));
// use a real executor
params = params.toBuilder().executor(ForkJoinPool.commonPool()).build();
// need a new future, with an exception
javaFuture = CompletableFuture.failedFuture(thrown);
- when(javaClient.sendAsync(any(), any(BodyHandlers.ofString().getClass()))).thenReturn(javaFuture);
+ lenient().when(javaClient.sendAsync(any(), any(BodyHandlers.ofString().getClass()))).thenReturn(javaFuture);
SoRequest req = new SoRequest();
req.setRequestId(REQ_ID);
@Test
public void testAddAuthHeader() {
Builder builder = mock(Builder.class);
- when(client.getUserName()).thenReturn("the-user");
- when(client.getPassword()).thenReturn("the-password");
+ lenient().when(client.getUserName()).thenReturn("the-user");
+ lenient().when(client.getPassword()).thenReturn("the-password");
oper.addAuthHeader(builder);
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
@Test
public void testAddAuthHeaderNoUser() {
Builder builder = mock(Builder.class);
- when(client.getPassword()).thenReturn("world");
+ lenient().when(client.getPassword()).thenReturn("world");
oper.addAuthHeader(builder);
verify(builder, never()).header(any(), any());
// repeat with empty username
- when(client.getUserName()).thenReturn("");
+ lenient().when(client.getUserName()).thenReturn("");
oper.addAuthHeader(builder);
verify(builder, never()).header(any(), any());
}
@Test
public void testAddAuthHeaderUserOnly() {
Builder builder = mock(Builder.class);
- when(client.getUserName()).thenReturn("my-user");
+ lenient().when(client.getUserName()).thenReturn("my-user");
oper.addAuthHeader(builder);
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
}
private void initHostPort() {
- when(client.getBaseUrl()).thenReturn("http://my-host:6969/");
+ lenient().when(client.getBaseUrl()).thenReturn("http://my-host:6969/");
}
@SuppressWarnings("unchecked")
private void configureResponse(String responseText) throws CoderException {
// indicate that the response was completed
- when(javaResp.statusCode()).thenReturn(200);
- when(javaResp.body()).thenReturn(responseText);
+ lenient().when(javaResp.statusCode()).thenReturn(200);
+ lenient().when(javaResp.body()).thenReturn(responseText);
javaFuture = CompletableFuture.completedFuture(javaResp);
- when(javaClient.sendAsync(any(), any(BodyHandlers.ofString().getClass()))).thenReturn(javaFuture);
+ lenient().when(javaClient.sendAsync(any(), any(BodyHandlers.ofString().getClass()))).thenReturn(javaFuture);
}
private class MyOperation extends VfModuleDelete {
<!--
============LICENSE_START=======================================================
Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<artifactId>utils-test</artifactId>
<version>${policy.common.version}</version>
</dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>compile</scope>
- </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.controlloop.actor.test;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.lenient;
import java.util.List;
import java.util.function.BiConsumer;
* Initializes a configuration.
*/
protected void initConfig() {
- when(config.getTopicHandler()).thenReturn(topicHandler);
- when(config.getForwarder()).thenReturn(forwarder);
- when(config.getTimeoutMs()).thenReturn(TIMEOUT_MS);
+ lenient().when(config.getTopicHandler()).thenReturn(topicHandler);
+ lenient().when(config.getForwarder()).thenReturn(forwarder);
+ lenient().when(config.getTimeoutMs()).thenReturn(TIMEOUT_MS);
}
/**
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.controlloop.actor.test;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.lenient;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
public void setUpBasic() {
super.setUpBasic();
- when(factory.get(MY_CLIENT)).thenReturn(client);
+ lenient().when(factory.get(MY_CLIENT)).thenReturn(client);
- when(rawResponse.getStatus()).thenReturn(200);
+ lenient().when(rawResponse.getStatus()).thenReturn(200);
- when(webBuilder.async()).thenReturn(webAsync);
- when(webBuilder.accept(any(MediaType.class))).thenReturn(webBuilder);
- when(webBuilder.accept(any(String.class))).thenReturn(webBuilder);
+ lenient().when(webBuilder.async()).thenReturn(webAsync);
+ lenient().when(webBuilder.accept(any(MediaType.class))).thenReturn(webBuilder);
+ lenient().when(webBuilder.accept(any(String.class))).thenReturn(webBuilder);
- when(webTarget.request()).thenReturn(webBuilder);
- when(webTarget.path(any())).thenReturn(webTarget);
- when(webTarget.queryParam(any(), any())).thenReturn(webTarget);
+ lenient().when(webTarget.request()).thenReturn(webBuilder);
+ lenient().when(webTarget.path(any())).thenReturn(webTarget);
+ lenient().when(webTarget.queryParam(any(), any())).thenReturn(webTarget);
- when(client.getWebTarget()).thenReturn(webTarget);
+ lenient().when(client.getWebTarget()).thenReturn(webTarget);
- when(client.getBaseUrl()).thenReturn(BASE_URI);
+ lenient().when(client.getBaseUrl()).thenReturn(BASE_URI);
initConfig();
}
* Initializes a configuration.
*/
protected void initConfig() {
- when(config.getClient()).thenReturn(client);
- when(config.getPath()).thenReturn(PATH);
+ lenient().when(config.getClient()).thenReturn(client);
+ lenient().when(config.getPath()).thenReturn(PATH);
}
/**
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
+@RunWith(MockitoJUnitRunner.class)
public class BasicHttpOperationTest {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.controlloop.actorserviceprovider.Util;
+@RunWith(MockitoJUnitRunner.class)
public class BasicOperationTest {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
<!--
============LICENSE_START=======================================================
Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.controlloop.actor.vfc;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.lenient;
import org.mockito.Mock;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
// PLD
- when(rawResponse.getStatus()).thenReturn(200);
- when(rawResponse.readEntity(String.class)).thenReturn(coder.encode(response));
+ lenient().when(rawResponse.getStatus()).thenReturn(200);
+ lenient().when(rawResponse.readEntity(String.class)).thenReturn(coder.encode(response));
initConfig();
}
@Override
protected void initConfig() {
super.initConfig();
- when(config.getClient()).thenReturn(client);
- when(config.getMaxPolls()).thenReturn(MAX_POLLS);
- when(config.getPollPath()).thenReturn(POLL_PATH);
- when(config.getPollWaitSec()).thenReturn(POLL_WAIT_SEC);
+ lenient().when(config.getClient()).thenReturn(client);
+ lenient().when(config.getMaxPolls()).thenReturn(MAX_POLLS);
+ lenient().when(config.getPollPath()).thenReturn(POLL_PATH);
+ lenient().when(config.getPollWaitSec()).thenReturn(POLL_WAIT_SEC);
}
}
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
+@RunWith(MockitoJUnitRunner.class)
public class RestartTest extends BasicVfcOperation {
private static final String TEST_SERVICE_INSTANCE_ID = "test-service-instance-id";
private static final String TEST_VSERVER_ID = "test-vserver-id";
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.vfc.VfcResponse;
import org.onap.policy.vfc.VfcResponseDescriptor;
+@RunWith(MockitoJUnitRunner.class)
public class VfcOperationTest extends BasicVfcOperation {
private VfcOperation oper;
ONAP
================================================================================
Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>compile</scope>
</dependency>
</dependencies>
</project>
* ONAP
* ================================================================================
* Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* 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.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import java.util.Map;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
+@RunWith(MockitoJUnitRunner.class)
public class ConfigureOperationTest extends BasicHttpOperation {
@Mock
super.setUpBasic();
operConfig = mock(DecisionConfig.class);
- when(operConfig.makeRequest()).thenAnswer(args -> {
+ lenient().when(operConfig.makeRequest()).thenAnswer(args -> {
DecisionRequest req = new DecisionRequest();
req.setAction("guard");
req.setOnapComponent("my-onap-component");
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.simulators.XacmlSimulatorJaxRs;
+@RunWith(MockitoJUnitRunner.class)
public class DecisionOperationTest extends BasicHttpOperation {
private static final List<String> PROPERTY_NAMES = List.of("prop-A", "prop-B");
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.simulators.XacmlSimulatorJaxRs;
+@RunWith(MockitoJUnitRunner.class)
public class GuardOperationTest extends BasicHttpOperation {
@Mock
<!--
============LICENSE_START=======================================================
Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
aai
================================================================================
Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-core</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>policy-endpoints</artifactId>
ONAP
================================================================================
Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019,2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>compile</scope>
</dependency>
</dependencies>
</project>
<!--
============LICENSE_START=======================================================
- Copyright (C) 2019 Nordix Foundation.
+ Copyright (C) 2019,2023 Nordix Foundation.
Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
* ONAP Policy Models
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.powermock.reflect.Whitebox;
+import org.springframework.test.util.ReflectionTestUtils;
public class TopicDataTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
*/
@SuppressWarnings("unchecked")
private Map<String, ConsumerGroupData> getGroups() {
- return (Map<String, ConsumerGroupData>) Whitebox.getInternalState(data, "group2data");
+ return (Map<String, ConsumerGroupData>) ReflectionTestUtils.getField(data, "group2data");
}
}
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019,2023 Nordix Foundation.
* Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import static org.assertj.core.api.Assertions.assertThatCode;
+import java.lang.reflect.Constructor;
import org.junit.Test;
-import org.powermock.reflect.Whitebox;
/**
* Class to perform unit test of {@link PdpSimulatorConstants}}.
@Test
public void test() throws Exception {
// verify that constructor does not throw an exception
- assertThatCode(() -> Whitebox.invokeConstructor(PdpSimulatorConstants.class)).doesNotThrowAnyException();
+ assertThatCode(() -> {
+ Constructor<PdpSimulatorConstants> c = PdpSimulatorConstants.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ c.newInstance();
+ }
+ ).doesNotThrowAnyException();
}
}
ONAP
================================================================================
Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2023 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>