KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > core > ShortcutsFolder66845Test


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.core;
21
22 import java.util.logging.Level JavaDoc;
23 import javax.swing.text.Keymap JavaDoc;
24 import org.netbeans.core.startup.Main;
25 import org.netbeans.junit.Log;
26 import org.netbeans.junit.NbTestCase;
27 import org.openide.filesystems.FileObject;
28 import org.openide.filesystems.FileSystem;
29 import org.openide.filesystems.FileUtil;
30 import org.openide.filesystems.Repository;
31 import org.openide.util.Lookup;
32
33 public class ShortcutsFolder66845Test extends NbTestCase {
34
35     public ShortcutsFolder66845Test(String JavaDoc s) {
36         super(s);
37     }
38
39     private Keymap JavaDoc keymap;
40     private CharSequence JavaDoc logs;
41
42     protected void setUp() throws Exception JavaDoc {
43         Main.initializeURLFactory ();
44         keymap = Lookup.getDefault().lookup(Keymap JavaDoc.class);
45         assertNotNull("There is a keymap", keymap);
46         assertEquals("of correct type", NbKeymap.class, keymap.getClass());
47         ShortcutsFolder.initShortcuts ();
48         logs = Log.enable(ShortcutsFolder.class.getName(), Level.WARNING);
49     }
50
51     public void testLogging() throws Exception JavaDoc {
52         final FileSystem fs = Repository.getDefault ().getDefaultFileSystem ();
53         final FileObject shortcuts = FileUtil.createData(fs.getRoot(), "Keymaps/NetBeans/org-nb-Neznam.instance");
54
55         ShortcutsFolder.waitFinished ();
56
57         assertTrue("got message in " + logs, logs.toString().contains("Neznam"));
58     }
59
60 }
61
Popular Tags