@Test
public void test1() {
}
|
public class Composite {
private Fraction fraction;
public Composite(int integer, Fraction f) {
this.fraction = f;
}
public Fraction getFraction() { return fraction; }
}
|
@Test
public void test2() {
Fraction f = new Fraction(3,2);
Composite c = new Composite(f);
assertEquals(1, c.getInteger());
asssertEquals(0.5, c.getFraction().toDouble());
Composite d = new Composite(new Fraction(9,4));
assertEquals(2, d.getInteger());
assertEquals(0.25, d.getFraction().toDouble());
}
|
|