Bug 643 - Unable to search for the Specific Processed Result
Summary: Unable to search for the Specific Processed Result
Status: RESOLVED FIXED
Alias: None
Product: 2021 CS3343 Hall Admission System
Classification: Unclassified
Component: System Section (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Assignee: Azim
URL:
Depends on:
Blocks:
 
Reported: 2021-12-04 16:23 HKT by amble3232
Modified: 2021-12-04 16:24 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;
	}
}