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:
![3. You are doing unit test using JUunit for the methods of the Account class code that is given below. Write](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/answers/2023/10/65205d84eeebf_90865205d84e9c54.jpg)
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
-
What is entrepreneurial leadership?
-
Ethics in Accounting The text has pointed out that ethics is an important topic, especially for CPAs. Derek Bok, former law professor and president of Harvard University, has suggested that colleges...
-
Automobile unit sales at B. J. Scott Motors, Inc., provided the following 10-year time series. a. Construct a time series plot. Comment on the appropriateness of a linear trend. b. Using Minitab or...
-
Lowes Companies, Inc. (LOW) and its subsidiaries operate as a home improvement retailer in the United States and Canada. As of February 1, 2008, it operated 1,534 stores in 50 states and Canada. The...
-
# of unit cost or items sale price July 1 Opening balance 45 $30 July 5 Purchase 20 $32 July 7 Purchase of July 5 items returned -5 July 10 Sale 45 $40 July 12 Purchase 25 $34 July 17 Sale 20 $50...
-
Among its other features, the MyTVLab website allows customers to purchase MyTVLab LifeStyles merchandise online. To handle payment processing, the management of MyTVLab has contracted with the...
-
You would like to borrow $25,000 from a local bank.You will make equal monthly payments over a fifteen-year period.What will your monthly payment be if yearly interest rate is 6%? A company is...
-
Y = AK[1-a R P = QAKa-1[1-a W P = (1 -Q) AKL-a 1= 14 1 -4 Y = C
-
Inferring Transactions from Financial Statements (FSET) Wired.com Inc. is a large e-commerce company, with over $31 billion in revenues for the fiscal year ended December 31, 20X2. For the year ended...
-
Finding Standard Deviation from a Frequency Distribution. In Exercises 37-40, refer to the frequency distribution in the given exercise and compute the standard deviation by using the formula below,...
-
For the past 30 years, the average satisfaction rating for a sushi restaurant has been 3.9 out of 5. If the rating for a sample of 256 people is 4.1 with a standard deviation of 0.5, the critical...
-
Hash collisions occur when more than one item is mapped to the same element in Hash Table's array. What is one way that a Hash Table can handle collisions?
-
QUESTION 34 A company has determined that a certain project will produce revenue of $14 million 1 year from now. The costs are projected to equal $5 million each 2, 3 and 4 years from now. Given a...
-
Chloroplasts are illuminated until the levels of the Calvin cycle intermediates reach a steady state. The light is then turned off. How does the level of RuBP vary after this point?
-
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...
-
Calculate the chi-square statistic, degrees of freedom, and P-value for a chi-square test based on data in a two-way table.
-
Compare conditional distributions for data in a two-way table.
-
Perform a chi-square test for independence.
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App