For simplicity put junit.jar and commons-lang-2.1.jar from the lib directory into a new empty directory.
Put this code into a file named FractionTest.java in that same directory:
import junit.framework.TestCase;
import org.apache.commons.lang.math.*;
public class FractionTest extends TestCase {
public void testAddition() {
Fraction half = Fraction.getFraction(2, 4);
Fraction fourth = Fraction.getFraction(1, 4);
Fraction actual = half.add(fourth);
Fraction expected = Fraction.getFraction(3, 4);
assertEquals(expected, actual);
}
}
Compiling:
$ javac -classpath junit.jar:commons-lang-2.1.jar FractionTest.java
Running:
$ java -classpath .:junit.jar:commons-lang-2.1.jar junit.swingui.TestRunner FractionTest