1 19 20 package org.netbeans.modules.xml.xam.ui.category; 21 22 import javax.swing.Icon ; 23 import javax.swing.JLabel ; 24 import junit.framework.TestCase; 25 import org.netbeans.modules.xml.xam.Component; 26 import org.openide.util.Lookup; 27 28 33 public class DefaultCategoryPaneTest extends TestCase { 34 35 public DefaultCategoryPaneTest(String testName) { 36 super(testName); 37 } 38 39 public void testAddSetGet() { 40 DefaultCategoryPane pane = new DefaultCategoryPane(); 41 Category c1 = new TestCategory(); 42 Category c2 = new TestCategory(); 43 Category c3 = new TestCategory(); 44 pane.addCategory(c1); 45 pane.addCategory(c2); 46 pane.addCategory(c3); 47 pane.setCategory(c1); 48 assertTrue(pane.getCategory() == c1); 49 pane.setCategory(c3); 50 assertTrue(pane.getCategory() == c3); 51 pane.setCategory(c2); 52 assertTrue(pane.getCategory() == c2); 53 } 54 55 58 private static class TestCategory extends AbstractCategory { 59 60 public void showComponent(Component component) { 61 } 62 63 public String getTitle() { 64 return ""; 65 } 66 67 public Lookup getLookup() { 68 return Lookup.EMPTY; 69 } 70 71 public Icon getIcon() { 72 return null; 73 } 74 75 public String getDescription() { 76 return ""; 77 } 78 79 public java.awt.Component getComponent() { 80 return new JLabel (); 81 } 82 83 public void componentShown() { 84 } 85 86 public void componentHidden() { 87 } 88 } 89 } 90 | Popular Tags |