|
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-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.openide.loaders; import java.io.File; import java.io.IOException; import java.beans.PropertyChangeEvent; import java.util.HashSet; import java.util.Set; import java.beans.PropertyChangeListener; import javax.swing.event.ChangeListener; import junit.textui.TestRunner; import org.openide.filesystems.*; import org.openide.nodes.*; import org.netbeans.junit.*; /** Checks the testable behaviour of TemplateWizard * @author Jaroslav Tulach */ public class TemplateWizardTest extends NbTestCase { public TemplateWizardTest (String name) { super(name); } public static void main(String[] args) { TestRunner.run(new NbTestSuite(TemplateWizardTest.class)); } /** Does getIterator honours DataObject's cookies? */ public void testGetIteratorHonoursDataObjectsCookies () throws Exception { LocalFileSystem fs = new LocalFileSystem (); DataObject obj; Loader l = (Loader)Loader.findObject (Loader.class, true); try { AddLoaderManuallyHid.addRemoveLoader (l, true); obj = DataObject.find (fs.getRoot ()); } finally { AddLoaderManuallyHid.addRemoveLoader (l, false); } TemplateWizard.Iterator it = TemplateWizard.getIterator (obj); assertEquals ("Iterator obtained from the object's cookie", obj, it); } private static class DO extends DataFolder implements TemplateWizard.Iterator { public DO (FileObject fo) throws DataObjectExistsException { super (fo); getCookieSet ().add (this); } // // Dummy implementation of wizard iterator // public void addChangeListener(ChangeListener l) { } public TemplateWizard.Panel current() { return null; } public boolean hasNext() { return false; } public boolean hasPrevious() { return false; } public void initialize(TemplateWizard wiz) { } public java.util.Set instantiate(TemplateWizard wiz) throws IOException { throw new IOException (); } public String name() { return ""; } public void nextPanel() { } public void previousPanel() { } public void removeChangeListener(ChangeListener l) { } public void uninitialize(TemplateWizard wiz) { } } // end of DO private static class Loader extends UniFileLoader { public Loader () { super (DO.class.getName ()); } protected FileObject findPrimaryFile (FileObject fo) { if (fo.isFolder ()) { return fo; } else { return null; } } protected MultiDataObject createMultiObject (FileObject fo) throws IOException { return new DO (fo); } } // end of Loader } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 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.