Interface:
public interface Krychle {
double povrch();
double objem();
}
Obdobný interface bude i pro ostatní tělesa.
Ukázka testů:
public class TestKrychle extends TestCase {
private Krychle krychle;
protected void setUp() throws Exception {
super.setUp();
/**@todo verify the constructors*/
krychle = new Krychle(7);
}
protected void tearDown() throws Exception {
krychle = null;
super.tearDown();
}
public void testPovrch() {
double expectedReturn = 294;
double actualReturn = krychle.povrch();
assertEquals(expectedReturn, actualReturn, 0.5);
}
public void testObjem() {
double expectedReturn = 343;
double actualReturn = krychle.objem();
assertEquals(expectedReturn, actualReturn, 0.5);
}
}
Obdobné testy jsou i pro ostatní tělesa.