Skip to main content

Posts

Showing posts from June, 2009

JUnit test : example

Here following is the class to be tested using JUnit public   class  MyClass  {      public   int   add( int  a, int  b ){          return  a + b;     }      public   int   sub( int  a, int  b ){          return  a - b;     }      public   int   mul( int  a, int  b ){          return  a * b;     }      public   int   div( int  a, int  b ){          return  a / b;     } } class that contains three testing method to test add method of class MyClass import   static  org.junit.Assert.assertEquals; import  org.junit. * ; public ...