Bug 643

Summary: Unable to search for the Specific Processed Result
Product: 2021 CS3343 Hall Admission System Reporter: amble3232
Component: System SectionAssignee: Azim <mohamazim2>
Status: RESOLVED FIXED    
Severity: normal CC: chpang22-c
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   

Description amble3232 2021-12-04 16:23:13 HKT
Background:
I am doing the unit test in ECLIPSE 2021-06 (4.20.0) on method viewSpecificResult() in HallSystem.
In testHallSystem testViewSpecificResult5(), I am trying to test finding the existing application status after process application.

Steps to Reproduce:
1. Run the package with testHall_Admission
2. Run the method “void testViewSpecificResult5” in testHallSystem class

Actual result:
It seems the system cannot find the application in the system as the system returned “null”

Expected result:
It should return “Admitted to Hall 2”.
Comment 1 newbie 2021-12-04 16:23:47 HKT
I just tried this test case, there is a null problem. I suspect the code of application searching or application storage has some problems. 

I will pass it to the developer to solve this error.
Comment 2 Azim 2021-12-04 16:24:25 HKT
The system was able the find the Application, but once the application was found, it got replaced to null due to the next application the system searched not fulfilling the search condition. As in the program loop, it keep updating the outData value via this code “outData = processResult.findInAdmit(target);”.

To solve the keep updating problem, a break condition is added.

Solution:
===============
public String findResultStatus(Application target) {

	for (ProcessResult processResult : allResults) {
		outData = processResult.findInAdmit(target);
		if(outData!=null) break;
	}

	if(outData == null) {
		outData = ProcessResult.findInWaiting(target);
	}
	
	if(outData == null) {
		outData = ProcessResult.findInReject(target);
	}
	
	return outData;
	}
}