X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=main%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fmain%2Frest%2FProviderSuper.java;h=e5a833057e9ab483491685e7324ea982dc1e4e56;hb=42c18ef1c6506e63151b55a96d90362da9fbda63;hp=60de563e8b00bbdf5dd875d98932a787602ae29d;hpb=eb4cf2ad5d004cbfda90a752d10fbc6e91ef8fb4;p=policy%2Fpap.git diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java b/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java index 60de563e..e5a83305 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/ProviderSuper.java @@ -3,7 +3,7 @@ * ONAP PAP * ================================================================================ * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021-2022 Nordix Foundation. + * Modifications Copyright (C) 2021-2023 Nordix Foundation. * Modifications Copyright (C) 2022-2023 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ package org.onap.policy.pap.main.rest; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -37,7 +37,8 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; -import org.junit.Before; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; @@ -95,15 +96,17 @@ public class ProviderSuper { protected ToscaPolicy policy1; protected MeterRegistry meterRegistry; + AutoCloseable closeable; + /** * Configures DAO, captors, and various mocks. */ - @Before + @BeforeEach public void setUp() throws Exception { Registry.newRegistry(); - MockitoAnnotations.openMocks(this); + closeable = MockitoAnnotations.openMocks(this); reqmap = mock(PdpModifyRequestMap.class); @@ -125,6 +128,11 @@ public class ProviderSuper { } + @AfterEach + public void tearDown() throws Exception { + closeable.close(); + } + /** * Initialize services to the provider for tests. * @@ -280,7 +288,7 @@ public class ProviderSuper { * Loads an object from a JSON file. * * @param fileName name of the file from which to load - * @param clazz the class of the object to be loaded + * @param clazz the class of the object to be loaded * @return the object that was loaded from the file */ protected T loadFile(String fileName, Class clazz) {