1 19 20 package org.netbeans.modules.junit; 21 22 import java.util.Iterator ; 23 import java.util.LinkedList ; 24 import java.util.TreeSet ; 25 import java.util.Enumeration ; 26 import java.awt.Image ; 27 import java.beans.*; 28 import org.openide.*; 29 import org.openide.filesystems.FileSystem; 30 import org.openide.filesystems.FileObject; 31 import org.openide.util.NbBundle; 32 import junit.framework.*; 33 34 public class JUnitSettingsBeanInfoTest extends TestCase { 35 36 public JUnitSettingsBeanInfoTest(java.lang.String testName) { 37 super(testName); 38 } 39 40 public static void main(java.lang.String [] args) { 41 junit.textui.TestRunner.run(suite()); 42 } 43 44 public static Test suite() { 45 TestSuite suite = new TestSuite(JUnitSettingsBeanInfoTest.class); 46 suite.addTest(BoolPropEdTest.suite()); 47 suite.addTest(SortedListPropEdTest.suite()); 48 suite.addTest(ExecutorPropEdTest.suite()); 49 suite.addTest(FileSystemPropEdTest.suite()); 50 51 return suite; 52 } 53 54 55 public void testGetPropertyDescriptors() { 56 System.out.println("testGetPropertyDescriptors"); 57 PropertyDescriptor d[] = jbi.getPropertyDescriptors(); 58 assertTrue(null != d); 59 } 60 61 62 public void testGetIcon() { 63 System.out.println("testGetIcon"); 64 Image i = jbi.getIcon(BeanInfo.ICON_COLOR_16x16); 65 assertTrue(null != i); 66 } 67 68 public static class BoolPropEdTest extends TestCase { 69 70 public BoolPropEdTest(java.lang.String testName) { 71 super(testName); 72 } 73 74 public static void main(java.lang.String [] args) { 75 junit.textui.TestRunner.run(suite()); 76 } 77 78 public static Test suite() { 79 TestSuite suite = new TestSuite(BoolPropEdTest.class); 80 81 return suite; 82 } 83 84 85 public void testGetTags() { 86 System.out.println("testGetTags"); 87 String tags[] = bped.getTags(); 88 assertTrue(null != tags); 89 assertTrue(2 == tags.length); 90 } 91 92 93 public void testGetAsText() { 94 System.out.println("testGetAsText"); 95 String s = bped.getAsText(); 96 assertTrue(null != s); 97 } 98 99 100 public void testSetAsText() { 101 System.out.println("testSetAsText"); 102 String s = bped.getAsText(); 104 String tags[] = bped.getTags(); 105 if (0 < tags.length) { 106 bped.setAsText(tags[0]); 107 assertEquals(tags[0], bped.getAsText()); 108 if (1 < tags.length) { 109 bped.setAsText(tags[1]); 110 assertEquals(tags[1], bped.getAsText()); 111 } 112 } 113 bped.setAsText(s); 114 } 115 116 protected JUnitSettingsBeanInfo.BoolPropEd bped; 118 119 protected void setUp() { 120 bped = new JUnitSettingsBeanInfo.BoolPropEd(); 121 } 122 } 123 124 public static class SortedListPropEdTest extends TestCase { 125 126 public SortedListPropEdTest(java.lang.String testName) { 127 super(testName); 128 } 129 130 public static void main(java.lang.String [] args) { 131 junit.textui.TestRunner.run(suite()); 132 } 133 134 public static Test suite() { 135 TestSuite suite = new TestSuite(SortedListPropEdTest.class); 136 137 return suite; 138 } 139 140 141 public void testGetTags() { 142 System.out.println("testGetTags"); 143 String tags[] = ped.getTags(); 144 assertTrue(null != tags); 145 assertTrue(2 == tags.length); 146 } 147 148 149 public void testGetAsText() { 150 System.out.println("testGetAsText"); 151 String s = ped.getAsText(); 152 assertTrue(null != s); 153 } 154 155 156 public void testSetAsText() { 157 System.out.println("testSetAsText"); 158 String s = ped.getAsText(); 160 String tags[] = ped.getTags(); 161 if (0 < tags.length) { 162 ped.setAsText(tags[0]); 163 assertEquals(tags[0], ped.getAsText()); 164 if (1 < tags.length) { 165 ped.setAsText(tags[1]); 166 assertEquals(tags[1], ped.getAsText()); 167 } 168 } 169 ped.setAsText(s); 170 } 171 172 173 public void testPut() { 174 System.out.println("testPut"); 175 176 fail("The test case is empty."); 178 } 179 180 JUnitSettingsBeanInfo.SortedListPropEd ped; 182 183 protected void setUp() { 184 ped = new JUnitSettingsBeanInfo.SortedListPropEd(); 185 ped.put("display3", "value3", JUnitSettingsBeanInfo.SortedListPropEd.SHOW_IN_LIST | JUnitSettingsBeanInfo.SortedListPropEd.IS_DEFAULT); 186 ped.put("display1", "value1", JUnitSettingsBeanInfo.SortedListPropEd.SHOW_IN_LIST); 187 ped.put("display2", "value2", JUnitSettingsBeanInfo.SortedListPropEd.IS_DEFAULT); 188 } 189 } 190 191 public static class ExecutorPropEdTest extends TestCase { 192 193 public ExecutorPropEdTest(java.lang.String testName) { 194 super(testName); 195 } 196 197 public static void main(java.lang.String [] args) { 198 junit.textui.TestRunner.run(suite()); 199 } 200 201 public static Test suite() { 202 TestSuite suite = new TestSuite(ExecutorPropEdTest.class); 203 204 return suite; 205 } 206 207 208 public void testGetTags() { 209 System.out.println("testGetTags"); 210 String tags[] = ped.getTags(); 211 assertTrue(null != tags); 212 assertTrue(3 == tags.length); 213 } 214 215 216 public void testGetAsText() { 217 System.out.println("testGetAsText"); 218 String s = ped.getAsText(); 219 assertTrue(null != s); 220 } 221 222 223 public void testSetAsText() { 224 System.out.println("testSetAsText"); 225 String s = ped.getAsText(); 226 String tags[] = ped.getTags(); 227 if (0 < tags.length) { 228 ped.setAsText(tags[0]); 229 assertEquals(tags[0], ped.getAsText()); 230 if (1 < tags.length) { 231 ped.setAsText(tags[1]); 232 assertEquals(tags[1], ped.getAsText()); 233 } 234 } 235 ped.setAsText(s); 236 } 237 238 protected JUnitSettingsBeanInfo.ExecutorPropEd ped; 240 241 protected void setUp() { 242 ped = new JUnitSettingsBeanInfo.ExecutorPropEd(); 243 } 244 } 245 246 public static class FileSystemPropEdTest extends TestCase { 247 248 public FileSystemPropEdTest(java.lang.String testName) { 249 super(testName); 250 } 251 252 public static void main(java.lang.String [] args) { 253 junit.textui.TestRunner.run(suite()); 254 } 255 256 public static Test suite() { 257 TestSuite suite = new TestSuite(FileSystemPropEdTest.class); 258 259 return suite; 260 } 261 262 public void testDummy() { 263 } 266 } 267 268 JUnitSettingsBeanInfo jbi; 270 271 protected void setUp() { 272 jbi = new JUnitSettingsBeanInfo(); 273 } 274 } 275 | Popular Tags |