|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.loaders; import junit.textui.TestRunner; import org.openide.filesystems.FileSystem; import java.util.Enumeration; import org.openide.nodes.Node; import org.openide.cookies.InstanceCookie; import org.openide.filesystems.Repository; import org.netbeans.junit.*; /** Test things about node delegates. * @author Jesse Glick */ public class DataNodeTest extends NbTestCase { public DataNodeTest(String name) { super(name); } public static void main(String[] args) { TestRunner.run(new NbTestSuite(DataNodeTest.class)); // Kill process since currently this pops up GUI windows or something: System.exit(0); } /* protected void setUp() throws Exception { } protected void tearDown() throws Exception { } */ /** Test that for all examples to be found in the system file system, * the node delegate has the same object as a cookie from DataObject.class. * (It is fine to have a different object from a more specific cookie, as * may happen in the case of a data shadow.) * See jglick's message on nbdev as of 22 Jun 2001: * assertTrue(dataObject.getNodeDelegate().getCookie(DataObject.class)==dataObject) */ public void testDataNodeHasObjectAsCookie() throws Exception { // First make sure some core is installed. This could be run inside or // outside a running IDE. // TopManager tm = TopManager.getDefault(); // Now scan SFS for all DO's and check the assertion. FileSystem sfs = Repository.getDefault().getDefaultFileSystem(); DataFolder top = DataFolder.findFolder(sfs.getRoot()); Enumeration e = top.children(true); while (e.hasMoreElements()) { DataObject o = (DataObject)e.nextElement(); Node n = o.getNodeDelegate(); DataObject o2 = (DataObject)n.getCookie(DataObject.class); assertEquals("Correct cookie from node delegate", o, o2); } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.