public void testAdd() { int num1 = 3; int num2 = 2; int total = 5; int sum = 0; sum = Math.add(num1, num2); assertEquals(sum, total); }
public static void main(String args[]) { Math m = new Math(); System.out.println("5 + 9 = " + m.add(5, 9)); System.out.println("8 - 2 = " + m.sub(8, 2)); System.out.println("4 x 7 = " + m.multiply(4, 7)); }
@Test public void testAddWithRealObject() throws Exception { simpleMathObject.add(3, 4); assertEquals(7, simpleMathObject.add(3, 4)); }