* ONAP
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 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.drools.utils;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
+import java.util.Objects;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.logging.LoggerUtils;
import org.onap.policy.common.utils.security.CryptoUtils;
import org.slf4j.Logger;
/**
* Test Setup -- Create a directory for temporary files.
*/
- @BeforeClass
+ @BeforeAll
public static void setup() {
logger.info("setup: creating a temporary directory");
/**
* Test Cleanup -- Remove temporary files.
*/
- @AfterClass
+ @AfterAll
public static void teardown() {
logger.info("teardown: remove the temporary directory");
// the assumption is that we only have one level of temporary files
- for (File file : directory.listFiles()) {
- file.delete();
+ for (File file : Objects.requireNonNull(directory.listFiles())) {
+ assertTrue(file.delete());
}
- directory.delete();
+ assertTrue(directory.delete());
}
/**
* Test the basic properties file interface.
*/
@Test
- public void testGetProperties() throws Exception {
+ void testGetProperties() throws Exception {
logger.info("testGetProperties: test the basic properties file interface");
// copy system properties
* This tests the 'PropertyUtil.Listener' interface.
*/
@Test
- public void testListenerInterface() throws Exception {
+ void testListenerInterface() throws Exception {
logger.info("testListenerInterface: test receipt of dynamic updates");
// create initial property file