From 32082ba6203aeb1533a06abf45edb12488f0a6a2 Mon Sep 17 00:00:00 2001 From: stephengold Date: Mon, 8 Jul 2024 15:11:01 -0700 Subject: [PATCH] Test003: refactor to the new testClose() method --- src/test/java/testjoltjni/junit/Test003.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/test/java/testjoltjni/junit/Test003.java b/src/test/java/testjoltjni/junit/Test003.java index dfdc308b..e10c54a7 100644 --- a/src/test/java/testjoltjni/junit/Test003.java +++ b/src/test/java/testjoltjni/junit/Test003.java @@ -81,7 +81,8 @@ public void test003() { Assert.assertTrue(jobSystem.hasAssignedNativeObject()); Assert.assertTrue(jobSystem.ownsNativeObject()); Assert.assertNotEquals(0L, jobSystem.va()); - jobSystem.close(); + + testClose(jobSystem); } // JobSystemThreadPool: @@ -99,7 +100,19 @@ public void test003() { jobSystem.setNumThreads(3); Assert.assertEquals(4, jobSystem.getMaxConcurrency()); - jobSystem.close(); + testClose(jobSystem); } + // ************************************************************************* + // Java private methods + + /** + * Test the {@code close()} method of the specified object. + * + * @param object the object to test (not null) + */ + private static void testClose(JoltPhysicsObject object) { + object.close(); + Assert.assertFalse(object.hasAssignedNativeObject()); + Assert.assertFalse(object.ownsNativeObject()); } }