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:30:35 UTC

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

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


##########
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:
   Opening source files is tedious if the tests were not run in the IDE. So it is useful to have some explanation in the console or test reports. Especially if many tests are failing, a quick look at the error messages help to chose on which test to focus first.



-- 
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