Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Let us consider an instantiable class that contains a compute method to validate handles/aliases. The compute method should work according to the following specification:
Let us consider an instantiable class that contains a compute method to validate handles/aliases. The compute method should work according to the following specification: the compute method should receive as an argument a piece of text (e. String) that represents an alias, and should check if the penultimate (.e., second to last) character of the alias is the symbol and the last character is the lower case letter z. When the alias ends with the two characters in the order mentioned earlier, the method should return the value true. Otherwise, when the alias does not end with the two specified characters the method should return the value false. Figure 4 presents a possible implementation. 2 public class AliasValidator { 4 9 10 11 12 13 15 16 17 public boolean validateAlias (String alias) { boolean validEnd; char lastCharacter = alias.charAt(0); char secondToLastCharacter alias.charAt(alias.length() - 2); if (secondToLastCharacter == '@' && lastCharacter == '2') { validEnd = true; } else { validEnd = false; } return validEnd; Figure 4 Source code for Question 2. B Implement all the required unit tests in order to achieve full code coverage according to the branch coverage technique. Run/execute the unit tests implemented at item a) and provide in your report a screenshot of the NetBeans Test Results Window that includes a summary of the execution of the unit tests (namely, for each unit test, the name of the test method run and whether the test has passed or failed). c) Implement all the required unit tests in order to check whether the compute method works according to expectation, namely according to the specification provided in Question 2. B. In case that there is any incorrect codellogic in the compute method, your unit test(s) should uncover such defects/bugs. d) Run/execute the unit tests implemented at item c) and provide in your report a screenshot of the NetBeans Test Results Window that includes a summary of the execution of the unit tests
Step by Step Solution
There are 3 Steps involved in it
Step: 1
1 Code Correction Ill correct the provided code snippet with proper syntax java public boolean isVal...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