public class RectangleTests { public void testSetSmall() { } public void testSetLarge() { } //======================================= public static void main(String[] args) { RectangleTests test = new RectangleTests(); test.testSetSmall(); test.testSetLarge(); } }
/** * Test that the method setSmall sets the Rectangle * to the expected width and height of 5 and 1. */ public void testSetSmall() { Rectangle rec;1rec = new Rectangle();2rec.setSmall(); System.out.println("-- testSetSmall --"); System.out.println("3Expected Width: " + 5); System.out.println("Expected Height: " + 1); System.out.println("Actual Width: " +4rec.getWidth()); System.out.println("Actual Height: " + rec.getHeight()); }
-- testSetSmall -- Expected Width: 5 Expected Height: 1 Actual Width: 5 Actual Height: 1
/** * Test that the method setSmall sets the Rectangle * to the expected width and height of 100 and 50. */ public void testSetLarge() { Rectangle rec;1rec = new Rectangle();2rec.setLarge(); System.out.println("-- testSetLarge --"); System.out.println("3Expected Width: " + 100); System.out.println("Expected Height: " + 50); System.out.println("Width: " +4rec.getWidth()); System.out.println("Height: " + rec.getHeight()); }
-- testSetLarge -- Expected Width: 100 Expected Height: 50 Width: 100 Height: 50
public class RectangleTests { /** Test that the method setSmall sets the Rectangle to the expected width and height of 5 and 1.*/ public void testSetSmall() { Rectangle rec; rec = new Rectangle(); rec.setSmall(); System.out.println("-- testSetSmall --"); System.out.println("Expected Width: " + 5); System.out.println("Expected Height: " + 1); System.out.println("Actual Width: " + rec.getWidth()); System.out.println("Actual Height: " + rec.getHeight()); } /** Test that the method setSmall sets the Rectangle to the expected width and height of 100 and 50.*/ public void testSetLarge() { Rectangle rec; rec = new Rectangle(); rec.setLarge(); System.out.println("-- testSetLarge --"); System.out.println("Expected Width: " + 100); System.out.println("Expected Height: " + 50); System.out.println("Width: " + rec.getWidth()); System.out.println("Height: " + rec.getHeight()); } //======================================= public static void main(String[] args) { RectangleTests test = new RectangleTests(); test.testSetSmall(); test.testSetLarge(); } }