You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/12/22 17:00:22 UTC

[GitHub] [netbeans] ehsavoie commented on a diff in pull request #5061: rewritten 2 tests of org.openide.util.TaskTest into more readable form

ehsavoie commented on code in PR #5061:
URL: https://github.com/apache/netbeans/pull/5061#discussion_r1055663501


##########
platform/openide.util/test/unit/src/org/openide/util/TaskTest.java:
##########
@@ -260,26 +303,32 @@ public void testWaitWithTimeOutReturnsAfterTimeOutWhenTheTaskIsNotComputedAtAll
         
         fail ("Something wrong happened the task should wait for 1000ms but it took: " + time + "\n" + log);
     }
+    
+    //--------------------------------------------------------------------------
     @Test
-    public void testWaitOnStrangeTaskThatStartsItsExecutionInOverridenWaitFinishedMethodLikeFolderInstancesDo () throws Exception {
+    public void waitOnTask_thatStartsItsExecutionWithOverridenWaitFinishedMethod() 
+            throws Exception { // like FolderInstances do
+        
         class MyTask extends Task {
-            private int values;
-            
-            public MyTask () {
-                notifyFinished ();
+
+            private int values = 0;
+
+            public MyTask() {
+                notifyFinished();
             }
-            
-            public void waitFinished () {
-                notifyRunning ();
+
+            @Override
+            public void waitFinished() {
+                notifyRunning();
                 values++;
-                notifyFinished ();
+                notifyFinished();
             }
         }
-        
-        MyTask my = new MyTask ();
-        assertTrue ("The task thinks that he is finished", my.isFinished ());
-        assertTrue ("Ok, even with timeout we got the result", my.waitFinished (1000));
-        assertEquals ("But the old waitFinished is called", 1, my.values);
+
+        MyTask my = new MyTask(); 
+        assertTrue(my.isFinished()); //The task thinks that he is finished.

Review Comment:
   Please put a message so that the test report is easier to read.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists