1 19 package org.netbeans.xml.test.core; 20 21 import junit.framework.Test; 22 import junit.framework.TestSuite; 23 import junit.textui.TestRunner; 24 import org.netbeans.junit.NbTestCase; 25 import org.netbeans.junit.NbTestSuite; 26 import org.openide.ErrorManager; 27 57 58 public class Fail extends NbTestCase { 59 public Fail(String testName) { 60 super(testName); 61 } 62 63 65 public static Test suite() { 66 TestSuite suite = new NbTestSuite(); 67 System.out.println(""); 68 System.out.println("SUIT, ktera nahlasi exception"); 69 int i = 1; 70 while (i-- > 0){ 71 try { 72 Thread.currentThread().sleep(3000); 73 } catch (InterruptedException ex) { 74 ex.printStackTrace(); 75 } 76 System.out.print("jeste zbyva"); 77 System.out.println(Integer.toString(i)); 78 } 79 System.out.println(""); 80 ErrorManager errMan = ErrorManager.getDefault(); 81 errMan.notify(errMan.USER,new NullPointerException ("MOJE EXCEPTION")); 82 try { 83 Thread.currentThread().sleep(10000); 84 } catch (InterruptedException ex) { 85 ex.printStackTrace(); 86 } 87 return suite; 89 } 90 91 public static void main(String [] args) throws Exception { 92 TestRunner.run(suite()); 95 } 96 97 } 98 99 100 101 | Popular Tags |