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

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


The following commit(s) were added to refs/heads/master by this push:
     new da3ce49  Recovering UsingFileSystemsMasterfs (#577)
da3ce49 is described below

commit da3ce49a5f386a48f6a7eee8c71afd5b47cfd8c1
Author: Antonio Vieiro <[email protected]>
AuthorDate: Mon Jan 17 07:03:57 2022 +0100

    Recovering UsingFileSystemsMasterfs (#577)
    
    Recovering documentation from 
https://web.archive.org/web/20100128225449/http://wiki.netbeans.org/UsingFileSystemsMasterfs
---
 .../content/wiki/UsingFileSystemsMasterfs.asciidoc | 65 ++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git 
a/netbeans.apache.org/src/content/wiki/UsingFileSystemsMasterfs.asciidoc 
b/netbeans.apache.org/src/content/wiki/UsingFileSystemsMasterfs.asciidoc
new file mode 100644
index 0000000..ae7371a
--- /dev/null
+++ b/netbeans.apache.org/src/content/wiki/UsingFileSystemsMasterfs.asciidoc
@@ -0,0 +1,65 @@
+// 
+//     Licensed to the Apache Software Foundation (ASF) under one
+//     or more contributor license agreements.  See the NOTICE file
+//     distributed with this work for additional information
+//     regarding copyright ownership.  The ASF licenses this file
+//     to you under the Apache License, Version 2.0 (the
+//     "License"); you may not use this file except in compliance
+//     with the License.  You may obtain a copy of the License at
+// 
+//       http://www.apache.org/licenses/LICENSE-2.0
+// 
+//     Unless required by applicable law or agreed to in writing,
+//     software distributed under the License is distributed on an
+//     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//     KIND, either express or implied.  See the License for the
+//     specific language governing permissions and limitations
+//     under the License.
+//
+= UsingFileSystemsMasterfs
+:jbake-type: wiki
+:jbake-tags: wiki, devfaq, needsreview
+:jbake-status: published
+:syntax: true
+:description: APITest SIGTest NetBeans
+:icons: font
+:source-highlighter: pygments
+:toc: left
+:toc-title:
+:experimental:
+
+You can use the Filesystems API freely in unit tests. For example:
+
+[source, java]
+----
+private FileObject d;
+protected void setUp() throws Exception {
+    clearWorkDir();
+    d = FileUtil.toFileObject(getWorkDir());
+    assertNotNull(d);
+}
+----
+
+If you try to run the above code, by default you will get an assertion error 
in setUp: `toFileObject` returns `null`. 
+
+This is because you need the "Master Filesystem module" available in order to 
translate Files into FileObjects. 
+
+Add to your `project.xml`:
+
+[source, xml]
+----
+<!-- if not already there:
+            <test-dependencies>
+                <test-type>
+                    <name>unit</name>
+-->
+                    <test-dependency>
+                        
<code-name-base>org.netbeans.modules.masterfs</code-name-base>
+                    </test-dependency>
+<!-- if not already there:
+                </test-type>
+            </test-dependencies>
+-->
+----
+
+Changes made using the Filesystems API should fire change events 
synchronously, which is helpful for testing code which listens for file changes.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to