Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer questions using from the java code: a) Detailing what tests you performed and your rational behind your tests. b) Where your tests always

Please answer questions using from the java code:

a) Detailing what tests you performed and your rational behind your tests.

b) Where your tests always successful?

c) What determines a successful test?

d) Snapshot of test results for any failures and ultimately of all successes

upload of the entire source code included in this assignment with the ADDITION of conducting the two additional tests as commented in the source.

ArithmeticFunctions.java

public class ArithmeticFunctions { public int sub(int a, int b) { return a - b; }

public int mult(int a, int b) { return a * b; }

public int add(int a, int b) { return a + b; }

public double div(int a, int b) { if (b != 0) { System.out.println("b cannot be 0"); return 0.0; } else { return a / b; }

} }

ArithmeticTest.java

import junit.framework.TestCase;

public class ArithmeticTest extends TestCase { ArithmeticFunctions functions = new ArithmeticFunctions(); ArithmeticFunctions functions1; public void test() { assertEquals("Addition of 5 and 7 is 12", 12, functions.add(5, 7)); } public void testForSub() { assertEquals("Subtraction of 5 and 7 is 2", 2, functions.sub(5, 7)); } public void testForNull(){ assertNull("Null value found" , functions1); } //students: test again for null value given functions1.add() //students: create an assert to test for div by zero!

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

4. Who should be invited to attend?

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago