Skip to Content
3
Former Member
Mar 04, 2019 at 04:30 PM

How to Cover a while loop in a Junit?

123 Views

Hi All,

I am facing difficulty in covering a while loop using a Junit. Please find the below piece of code:

while (dateUtils.compareDates(pagBegTime, apiEndTime) && !JobStatus.STOPPED.equals(manageAPIData.getJobStatus()))

dateUtils.compareDates- returns true if pagBegTime is less than apiEndTime. !JobStatus.STOPPED.equals(manageAPIData.getJobStatus()- return true if jobstatus is other than Stopped.

Thanks in Advance.