purpose | name | revision | download location |
---|---|---|---|
building projects | ant | 1.4.1 | http://jakarta.apache.org/builds/jakarta-ant/release/v1.4.1/src/jakarta-ant-1.4.1-src.tar.gz |
testing code | junit | 3.7 | http://download.sourceforge.net/junit/junit3.7.zip |
public
scope)
you should define it's behaviour by writing explicit tests for it.
class Foo {
int _x;
public Foo () {}
public int get() { }
public Object doSomething( Object val ) {}
}
void testInit () {
Foo f = new Foo();
assertEquals( 2, f.get() );
}
void testDoNotNull () {
Foo f = new Foo();
assertNotNull( f.doSomething( null ) );
}
void testDoInc () {
Foo f = new Foo();
f.doSomething( "val" );
assertEquals( 3, f.get() );
f.doSomething( "val" );
assertEquals( 4, f.get() );
}
Now AFTER having defined the behaviour of the interface
you implement it:
class Foo {
int _x;
public Foo () { _x = 2; }
public int get() { return _x; }
public Object doSomething( Object val ) { return null == val ? "null" : val; }
}
org.owasp.webscarab