3. You are doing unit test using JUunit for the methods of the Account class code...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. You are doing unit test using JUunit for the methods of the Account class code that is given below. Write the appropriate assertion statements so that the tests pass in the three different versions of the test program given below. [3] public class Account private String name; private double balance; private boolean overDraft Protection; public Account (String name, double balance, t } public void deposit (double } A if (depositAmount > 0.0) } boolean overDraft Protection) this.name name; if (balance > 0.0) this.balance balance; { } balance public double getBalance() return balance; balance + depositAmount; public void setover Draft Protection( depositAmount) boolean overDraft Protection) this.overDraft Protection - overDraft Protection; public boolean getover Draft Protection () return overDraft Protection; public void setName (String name) this.name name; public String getName()) return name; // end class Account import static org.junit.Assert.assertEquals; import org.junit. Test: public class TestAccount ( @Test public void accountEvaluator () ( String name "John Doe"; double bal - 750.00; // balance boolean odp- true; // Overdraft Protection Account ac new Account (name, bal, odp); double balance ac.getBalance(); // TO DO- assertion code, test to pass Code Listing 2: Test for Account Balance import static org.junit.Assert.assertEquals; import org.junit. Test: public class TestAccount ( @Test public void accountEvaluator() { String name "John Doe"; double bal - 750.00: boolean odp- true; // Overdraft Protection Account ac new Account (name, bal, odp): ac.deposit (500.0); double balance - ac.getBalance (); // TO DO assertion code, test to pass Code Listing 3: Test for Deposit import static org.junit.Assert.assertFalse; import org. junit. Test; public class TestAccount ( @Test public void account Evaluator () { String name= "John Doe"; double bal - 750.0; // balance. boolean odp= true; // Overdraft Protection Account ac new Account (name, bal, odp); ac.setOverDraft Protection (false); boolean cond ac.getOverDraft Protection (); // TO DO assertion code, test to pass 3. You are doing unit test using JUunit for the methods of the Account class code that is given below. Write the appropriate assertion statements so that the tests pass in the three different versions of the test program given below. [3] public class Account private String name; private double balance; private boolean overDraft Protection; public Account (String name, double balance, t } public void deposit (double } A if (depositAmount > 0.0) } boolean overDraft Protection) this.name name; if (balance > 0.0) this.balance balance; { } balance public double getBalance() return balance; balance + depositAmount; public void setover Draft Protection( depositAmount) boolean overDraft Protection) this.overDraft Protection - overDraft Protection; public boolean getover Draft Protection () return overDraft Protection; public void setName (String name) this.name name; public String getName()) return name; // end class Account import static org.junit.Assert.assertEquals; import org.junit. Test: public class TestAccount ( @Test public void accountEvaluator () ( String name "John Doe"; double bal - 750.00; // balance boolean odp- true; // Overdraft Protection Account ac new Account (name, bal, odp); double balance ac.getBalance(); // TO DO- assertion code, test to pass Code Listing 2: Test for Account Balance import static org.junit.Assert.assertEquals; import org.junit. Test: public class TestAccount ( @Test public void accountEvaluator() { String name "John Doe"; double bal - 750.00: boolean odp- true; // Overdraft Protection Account ac new Account (name, bal, odp): ac.deposit (500.0); double balance - ac.getBalance (); // TO DO assertion code, test to pass Code Listing 3: Test for Deposit import static org.junit.Assert.assertFalse; import org. junit. Test; public class TestAccount ( @Test public void account Evaluator () { String name= "John Doe"; double bal - 750.0; // balance. boolean odp= true; // Overdraft Protection Account ac new Account (name, bal, odp); ac.setOverDraft Protection (false); boolean cond ac.getOverDraft Protection (); // TO DO assertion code, test to pass
Expert Answer:
Answer rating: 100% (QA)
It looks like youre working on creating unit tests for the Account class using JUnit and you need to ... View the full answer
Related Book For
Auditing A Practical Approach
ISBN: 9780730382645
4th Edition
Authors: Robyn Moroney, Fiona Campbell, Jane Hamilton
Posted Date:
Students also viewed these programming questions
-
Patient services revenues is the better cost driver. I selected this choice because the Revenues for Patient services should remain fairly relative from year to year whereas the number of bills...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
In this assignment, you will have to write a doubly-linkedlist-based partial implementation of the List interface. Unlike theexisting java.util.LinkedList, your implementation is to optimizethe...
-
Factor completely. 3(r + 5) - 11(r + 5) 4
-
A spherical lightbulb of diameter 3.20 cm radiates light equally in all directions, with power 4.50 W. (a) Find the light intensity at the surface of the bulb. (b) Find the light intensity 7.20 m...
-
Make a list of the benefits that may arise from genetic testing as well as possible negative consequences. Discuss the items on your list.
-
Use a stem-and-leaf plot to display the data set. Describe any patterns. Use the data set, which represents the pollution indices for 24 U.S. cities. 22 41 46 50 38 57 65 49 41 23 38 65 28 36 63 54...
-
Mark Martinko has been a class A racquetball player for the past five years, and one of his biggest goals is to own and operate a racquetball facility. Unfortunately, Mark's thinks that the chance of...
-
At the indicated point for the function, find the following. (Round your answers to the nearest whole number.) y = (x3 + 4x) at x = 2 (a) Find the slope of the tangent line at the given value. (b)...
-
Jack Tasker opened his Auto Repair Shop in November 2023. The balance sheet at November 30, 2023, prepared by an inexperienced part-time bookkeeper, is shown below. Required Prepare a correct balance...
-
A stationary block of mass 1 kg slides down a smooth surface (friction can be ignored) of a bowl of a radius 1.1 m from it's rim (point A) to it's bottom (point B) as shown in the figure below....
-
Gerhan Company's flexible budget for the units actually manufactured in May shows $15,640 of total factory overhead; this output level represents 70% of available capacity. During May the company...
-
The term of this Lease Agreement is for a period commencing on the 1st day of April, Year 3, through the 31st day of March, Year 4. Base Rate and Utilities: Subject to the provisions of this Lease...
-
What nuanced strategies can be employed to navigate the complexities of multitasking, ensuring that simultaneous responsibilities are managed with finesse and without compromising quality?
-
Gender differences are challenging and evoke many feelings based on one's values, beliefs, culture, and societal acceptance. Create 2 Literature Reviews on Gender Differences .Use scholarly articles...
-
Reporting of items (e.g., discontinued operations) within an accounting period on the income statement or statement of retained earnings net of tax. Such allocation relates the income tax expense of...
-
Hannan Company uses the periodic inventory system for June 2015, the following information is available. June 1: Beginning inventory June 15: Purchase June 23: Purchase Method FIFO LIFO During June...
-
Could a set of three vectors in span all of? Explain. What about n vectors in when n is less than m? R4
-
The auditor is planning for the audit of a specialty retail store. Inventory is material, and items range in value from $1 to over $500. The nature of the store means that the type of merchandise...
-
The reliability of data used for analytical procedures: (a) Affects the persuasiveness of the evidence from analytical procedures. (b) Is more useful on a consolidated basis than an individual...
-
Why is an auditor interested in PPE that is not currently being used or that could become idle in the near future? Why would an auditor review directors' board minutes to gather information about...
-
Suppose we wish to estimate the probability of a rare event (such as a default probability). Let the random variable \(X\) be equal to 1 if the event occurs and to zero otherwise. Then...
-
Show that \(\left(\frac{1}{2}, \frac{1}{2} ight)\) is the optimal policy for Example 18.2 . Example 18.2 (Volatility pumping) Suppose there are two assets available for investment. One is a stock...
-
In a certain state lottery, people select eight numbers in advance of a random drawing of six numbers. If someone's selections include the six drawn, they receive a large prize, but this prize is...
Study smarter with the SolutionInn App