From a65e4772f4557a109917532b2d9c49680ce3bb15 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Fri, 14 Sep 2018 16:45:06 +0100 Subject: Fix exception not logged or rethrown Eclipse sonarlint does not check for exception dropping by default, it must be configured. This commit addresses exception dropping in apex. Change-Id: I406838990b3424c2912124b25d7326502cacc96c Issue-ID: POLICY-1034 Signed-off-by: liamfallon --- .../apex/model/enginemodel/concepts/TestEngineStats.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'model/engine-model/src/test') diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java index fb99e265b..8bd5756ab 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/TestEngineStats.java @@ -38,6 +38,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestEngineStats { + private static final Object WAIT_LOCK = new Object(); @Test public void testEngineStats() { @@ -98,11 +99,15 @@ public class TestEngineStats { stats.engineStart(); stats.setEventCount(4); stats.executionEnter(new AxArtifactKey()); - try { - Thread.sleep(10); - } catch (final Exception e) { - fail("test should not throw an exeption"); + + synchronized (WAIT_LOCK) { + try { + WAIT_LOCK.wait(10); + } catch (InterruptedException e) { + fail("test should not throw an exception"); + } } + stats.executionExit(); final double avExecutionTime = stats.getAverageExecutionTime(); assertTrue(avExecutionTime >= 2.0 && avExecutionTime < 10.0); -- cgit 1.2.3-korg