Created attachment 17 [details] Capscreen of incorrect result output found for the second test case of legal hand As shown in the captured screen, the output for the second test case is incorrect. It combines the name of legal hand type and fan points belong to the first test case. How to reproduce: 1. write 2 (or more)separate test cases in class CalculatorTest.java under package testcase 2. Select tab "Run" -> option "Run" (Ctrl + F11) to compile the program Expected result: Is a legal Hand Type Points: 8 Name: Big Dragon Is a legal Hand Type Points: 1 Name: Common Hand Actual result: Is a legal Hand Type Points: 8 Name: Big Dragon Is a legal Hand Type Points: 9 Name: Big Dragon Common Hand
(In reply to kinlokho2-c from comment #0) > Created attachment 17 [details] > Capscreen of incorrect result output found for the second test case of legal > hand > > As shown in the captured screen, the output for the second test case is > incorrect. It combines the name of legal hand type and fan points belong to > the first test case. > > How to reproduce: > 1. write 2 (or more)separate test cases in class CalculatorTest.java under > package testcase > 2. Select tab "Run" -> option "Run" (Ctrl + F11) to compile the program > > Expected result: > Is a legal Hand Type > Points: 8 > Name: Big Dragon > > Is a legal Hand Type > Points: 1 > Name: Common Hand > > Actual result: > Is a legal Hand Type > Points: 8 > Name: Big Dragon > > Is a legal Hand Type > Points: 9 > Name: Big Dragon Common Hand To fix: Modify the code so that the name and fan point of the previous legal hand will not accumulate and combine to the following test cases.
I recheck the code again and I discovered that the singleton pattern in PointAccumulator class was misused and made the following modification on the code. I removed the code related to Singleton Pattern in PointAccumulator class and rerun the system again. The actual output of test cases become the same as the expected outcome. The result (hand type name and fan points) of the first test case does not bring forwards to the following test cases.
Created attachment 17 [details] Capscreen of incorrect result output found for the second test case of legal hand As shown in the captured screen, the output for the second test case is incorrect. It combines the name of legal hand type and fan points belong to the first test case. How to reproduce: 1. write 2 (or more)separate test cases in class CalculatorTest.java under package testcase 2. Select tab "Run" -> option "Run" (Ctrl + F11) to compile the program Under the platform - Elicpse Java Oxygen (version 3a) Expected result: Is a legal Hand Type Points: 8 Name: Big Dragon Is a legal Hand Type Points: 1 Name: Common Hand Actual result: Is a legal Hand Type Points: 8 Name: Big Dragon Is a legal Hand Type Points: 9 Name: Big Dragon Common Hand