Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want passed JUnit Test in Netbean 8.2 for existing class Adding JUnit Test Classes First, you need to complete 2018-02-14a Prep for JUnit Assignment.pptx
I want passed JUnit Test in Netbean 8.2 for existing class
Adding JUnit Test Classes First, you need to complete 2018-02-14a Prep for JUnit Assignment.pptx Then, you will add JUnit tests for the following methods in the appropriate test classes u will use THIS as your guide to naming the tests o With this exception put an underscore after "test" I give you the name of the test methods in the table below Class to test Method to test AgeConverter Integer convertReverse(String) AgeConverter Integer convertReverse(String) If passed a null, it should return O AgeConverter Integer convertReverse(String) What to test If passed a string with all numerical values, it should return that string converted to an integer Test method name Notes test convertReverse GetsNumerical_Returnsint (1) test_convertReverse GetsNull_Returnso test-convertReverse-Gets NonNumerical Returns( If passed a string with any non-numerical values, it should return 0 If passed an integer, it should return the string value of the AgeConverter Integer convertFor ward(Intege gven integer test convertForward _GetsNumerical_ReturnsValue (1) If passed a null, it should return a string "null" not the actual null value, but string "null) AgeConverter Integer convertForward(Integer) test convertForward_GetsNuReturnsStringNull If passed an integer greater than one, or less than 199, it should return null AgeValidator Validator.Result validate(Integer) test validate GetsInRangeAge ReturnsNu EmailValidator Validator.Result validate(String) If passed in a valid email address, it should return null . Notes test validate GetsValidEmail ReturnsNull You won't be running the application, just running the tests . So, while editing your test classes, just it Ctrl-F6 to run the tests You must use the approprate assert method . e.g., assertNull, assertEqual, etc... o You must have an appproprate message as the first argument to the assertion when testing more than one value. use a for loop and iterate over the values Do not have 4 asserts - Have one assert inside a loop (1) Test at least 3 values (2) Test 2 valid values and the 2 edge cases Edge cases would be 1 and 199 because those are on the "edge" of the test range Adding JUnit Test Classes First, you need to complete 2018-02-14a Prep for JUnit Assignment.pptx Then, you will add JUnit tests for the following methods in the appropriate test classes u will use THIS as your guide to naming the tests o With this exception put an underscore after "test" I give you the name of the test methods in the table below Class to test Method to test AgeConverter Integer convertReverse(String) AgeConverter Integer convertReverse(String) If passed a null, it should return O AgeConverter Integer convertReverse(String) What to test If passed a string with all numerical values, it should return that string converted to an integer Test method name Notes test convertReverse GetsNumerical_Returnsint (1) test_convertReverse GetsNull_Returnso test-convertReverse-Gets NonNumerical Returns( If passed a string with any non-numerical values, it should return 0 If passed an integer, it should return the string value of the AgeConverter Integer convertFor ward(Intege gven integer test convertForward _GetsNumerical_ReturnsValue (1) If passed a null, it should return a string "null" not the actual null value, but string "null) AgeConverter Integer convertForward(Integer) test convertForward_GetsNuReturnsStringNull If passed an integer greater than one, or less than 199, it should return null AgeValidator Validator.Result validate(Integer) test validate GetsInRangeAge ReturnsNu EmailValidator Validator.Result validate(String) If passed in a valid email address, it should return null . Notes test validate GetsValidEmail ReturnsNull You won't be running the application, just running the tests . So, while editing your test classes, just it Ctrl-F6 to run the tests You must use the approprate assert method . e.g., assertNull, assertEqual, etc... o You must have an appproprate message as the first argument to the assertion when testing more than one value. use a for loop and iterate over the values Do not have 4 asserts - Have one assert inside a loop (1) Test at least 3 values (2) Test 2 valid values and the 2 edge cases Edge cases would be 1 and 199 because those are on the "edge" of the test rangeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started