From 09c90eb9929d4f193589506476d3f2de881c44dc Mon Sep 17 00:00:00 2001 From: CoreRasurae <luis.p.mendes@gmail.com> Date: Fri, 27 Apr 2018 13:45:18 +0100 Subject: [PATCH] Fix: Fixes issue #118 and improves OpenCLDevice.configure() exception handling - Codacy --- .../com/aparapi/runtime/OpenCLDeviceConfiguratorTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/aparapi/runtime/OpenCLDeviceConfiguratorTest.java b/src/test/java/com/aparapi/runtime/OpenCLDeviceConfiguratorTest.java index 388fffdf..78fd2c59 100644 --- a/src/test/java/com/aparapi/runtime/OpenCLDeviceConfiguratorTest.java +++ b/src/test/java/com/aparapi/runtime/OpenCLDeviceConfiguratorTest.java @@ -26,6 +26,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.junit.After; @@ -223,15 +224,17 @@ public class OpenCLDeviceConfiguratorTest { @Test public void noExceptionConfiguratorTest() { + final AtomicBoolean called = new AtomicBoolean(false); OpenCLDevice dev = new OpenCLDevice(null, 101L, Device.TYPE.CPU); IOpenCLDeviceConfigurator configurator = new IOpenCLDeviceConfigurator() { @Override public void configure(OpenCLDevice device) { + called.set(true); throw new IllegalArgumentException("This exception is part of the test, shouldn't cause test to fail"); } }; OpenCLDevice.setConfigurator(configurator); dev.configure(); - assertTrue(true); + assertTrue("Configurator should have benn called", called.get()); } } -- GitLab