/** * TestBall Class * - Tests the Ball Class * @author Akbar Sherwani * @date 22nd Decemeber * @version 0.1 */ public class TestBall { Ball ball; Position pos1; Position pos2; public TestBall() { System.out.println("Testing Ball Class:"); // Intilase Class ball = new Ball(); pos1 = new Position(); pos2 = new Position(); // Run Tests and final call if(testGeters() && testpythag() && testDistance()) { System.out.println("Ball Class Passed :)"); System.out.println("-------------------------------"); } else { System.out.println("Ball Class Failed"); System.out.println("-------------------------------"); } } public static void main(String[] args) { new TestBall(); } public boolean testGeters() { if(ball.getPosx() == 0) { System.out.println("Set and Get Test Passed"); return true; } else { System.out.println("! Set and Get Test Failed"); return false; } } public boolean testpythag() { // checks its public not private if(ball.pythag(8.0, 6.0) == 10.0) { System.out.println("Pythag Test Passed"); return true; } else { System.out.println("! Pythag Test Failed"); return false; } } public boolean testDistance() { // checks its public not private if(ball.Distance(pos1, pos2) == 0.0) { System.out.println("Distance Test Passed"); return true; } else { System.out.println("! Distance Test Failed"); return false; } } }