diff options
author | huaxing <huaxing.jin@est.tech> | 2020-06-10 14:58:34 +0800 |
---|---|---|
committer | huaxing <huaxing.jin@est.tech> | 2020-06-12 09:59:42 +0800 |
commit | 718a1611a1e580ed7874088e1a0e013416334989 (patch) | |
tree | 605f35ec8940bb986deaf7b96a76b97709ba7b76 /testsuites/performance/performance-benchmark-test | |
parent | 950622063ecc737ef7106ed9c380a077441b76aa (diff) |
Improve robustness of unit testing
Issue-ID: POLICY-2630
Signed-off-by: huaxing <huaxing.jin@est.tech>
Change-Id: I6475f9272c1a770836af537c13b23e486b66ac3e
Diffstat (limited to 'testsuites/performance/performance-benchmark-test')
2 files changed, 4 insertions, 4 deletions
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java index 36d6add43..3f6cad8e7 100644 --- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java +++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator; import java.io.IOException; import java.net.URI; +import java.nio.file.InvalidPathException; import java.util.Arrays; import org.apache.commons.cli.ParseException; @@ -104,7 +105,7 @@ public class EventGenerator { if (parameters.getOutFile() != null) { try { TextFileUtils.putStringAsTextFile(getEventGenerationStats(), parameters.getOutFile()); - } catch (IOException ioe) { + } catch (IOException | InvalidPathException ioe) { LOGGER.warn("could not output statistics to file \"" + parameters.getOutFile() + "\"", ioe); } } diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java index 3d37b3f4c..dcbafba07 100644 --- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java +++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorTest.java @@ -140,7 +140,7 @@ public class EventGeneratorTest { @Test public void testEventGeneratorOutfileBad() { EventGeneratorParameters pars = new EventGeneratorParameters(); - pars.setOutFile("/I/Dont/Exist"); + pars.setOutFile("/I/Dont/Exist*"); EventGenerator generator = new EventGenerator(pars); assertNotNull(generator); @@ -151,7 +151,6 @@ public class EventGeneratorTest { final String outString = outContent.toString(); System.setOut(stdout); - - assertTrue(outString.contains("could not output statistics to file \"/I/Dont/Exist\"")); + assertTrue(outString.contains("could not output statistics to file \"/I/Dont/Exist*\"")); } } |