Sample Application: Unit Testing Java


package net.unicon;


public class Thing {

    public String testMe(int x) {
    return new Integer(x+1).toString();
    }
}

package net.unicon;


//GroovyTestCase is automatically imported, though not everything is
class ThingTest extends GroovyTestCase { 

  void testTestMe() {
    Thing thing = new Thing();
    assertEquals("3", thing.testMe(2));
  }
}

[bruce@kimura presentation]$ groovy ThingTest.groovy
.
Time: 0.006

OK (1 test)

Next