You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2018/01/16 20:33:26 UTC

[incubator-netbeans] 03/04: ContentProviderTests depended on method execution order

This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git

commit b5d5ee4ccce78703d26030c67d3b79a74f4d6a2c
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Sun Jan 14 21:16:44 2018 +0100

    ContentProviderTests depended on method execution order
    
    The ContentProviderTest was marked as RandomlyFails. The problem depends
    of method invocation order. The embedded LayerProvider is "cleared" in
    "testRefreshTheProvider" and then "testCheckAFileFromOurLayer" fails
    because it expectes the contents to be still present.
    
    The fix introduces a "reset" method for the MyProvider, which restores
    the state after initialization.
---
 .../src/org/openide/filesystems/ContentProviderTest.java    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/openide.filesystems/test/unit/src/org/openide/filesystems/ContentProviderTest.java b/openide.filesystems/test/unit/src/org/openide/filesystems/ContentProviderTest.java
index ef5425f..6a2e0e5 100644
--- a/openide.filesystems/test/unit/src/org/openide/filesystems/ContentProviderTest.java
+++ b/openide.filesystems/test/unit/src/org/openide/filesystems/ContentProviderTest.java
@@ -22,7 +22,6 @@ import java.net.URL;
 import java.util.Collection;
 import org.netbeans.junit.MockServices;
 import org.netbeans.junit.NbTestCase;
-import org.netbeans.junit.RandomlyFails;
 import org.openide.filesystems.Repository.LayerProvider;
 import org.openide.util.Lookup;
 
@@ -35,7 +34,12 @@ public class ContentProviderTest extends NbTestCase {
         super(name);
     }
 
-    @RandomlyFails // http://deadlock.netbeans.org/job/NB-Core-Build/9882/testReport/
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        Lookup.getDefault().lookup(MyProvider.class).reset();
+    }
+
     public void testCheckAFileFromOurLayer() {
         FileObject fo = FileUtil.getConfigFile("foo/bar");
         assertNotNull("foo/bar is provided", fo);
@@ -69,5 +73,10 @@ public class ContentProviderTest extends NbTestCase {
             empty = true;
             refresh();
         }
+        
+        final void reset() {
+            empty = false;
+            refresh();
+        }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@netbeans.apache.org" <co...@netbeans.apache.org>.

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

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