tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject [06/13] tomee git commit: TOMEE-2301 - update test
Date Wed, 26 Dec 2018 14:02:30 GMT
TOMEE-2301 - update test

Signed-off-by: brunobat <brunobat@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5a6818be
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5a6818be
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5a6818be

Branch: refs/heads/master
Commit: 5a6818be981f4ee719d252bc953a2700fb1a3581
Parents: 46cb50f
Author: brunobat <brunobat@gmail.com>
Authored: Tue Dec 18 23:35:04 2018 +0000
Committer: brunobat <brunobat@gmail.com>
Committed: Tue Dec 18 23:35:04 2018 +0000

----------------------------------------------------------------------
 .../executor/ThreadFactoryServiceTest.java      | 23 +++++---------------
 1 file changed, 5 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/5a6818be/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
index e2e15c6..9a4c205 100644
--- a/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
+++ b/examples/concurrency-utils/src/test/java/org/superbiz/executor/ThreadFactoryServiceTest.java
@@ -9,11 +9,9 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import javax.inject.Inject;
-import java.util.concurrent.TimeUnit;
 import java.util.logging.Logger;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 
 
 /**
@@ -35,8 +33,6 @@ import static org.junit.Assert.assertTrue;
 @RunWith(Arquillian.class)
 public class ThreadFactoryServiceTest {
 
-    private static final Logger LOGGER = Logger.getLogger(ThreadFactoryServiceTest.class.getSimpleName());
-
     @Inject
     private ThreadFactoryService factoryService;
 
@@ -49,22 +45,13 @@ public class ThreadFactoryServiceTest {
 
     @Test
     public void asyncTask() throws InterruptedException {
-
-        final Thread thread = factoryService.asyncTask(1);
-        assertTrue(thread.isAlive());
-
-        LOGGER.info("Do something else");
-        TimeUnit.MILLISECONDS.sleep(200);
-
-        assertFalse(thread.isAlive());
+        //task was completed
+        assertEquals(2, factoryService.asyncTask(1));
     }
 
     @Test
     public void asyncHangingTask() throws InterruptedException {
-
-        final Thread thread = factoryService.asyncHangingTask(1);
-        LOGGER.info("Do something else");
-        TimeUnit.MILLISECONDS.sleep(200);
-        assertFalse(thread.isAlive());
+        // task was interrupted and operation was not completed.
+        assertEquals(1, factoryService.asyncHangingTask(1));
     }
 }
\ No newline at end of file


Mime
View raw message