Mega Code Archive

 
Categories / Java / Development Class
 

JUnit Extends TestCase

import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class MainClass extends TestCase{   public static void main (String[] args) {     junit.textui.TestRunner.run (suite());   }      public static junit.framework.Test suite() {     return new TestSuite(MainClass.class);   }   public void testAdd() {     assertTrue(6 == 6);   }   public void testDivideByZero() {     int zero= 0;     int result= 8/zero;   }   public void testEquals() {     assertEquals(12, 12);   } }                          JUnit-ExtendsTestCase.zip( 96 k)