Weird issue, hidden test passing at night but not during the day

I was failing the test
com.crio.qeats.controller.RestaurantControllerDebugModuleHiddenTest1 > hiddenTest2() FAILED org.opentest4j.AssertionFailedError at

After adding logs and debugging, I found the reason for this to be that for this particular test, my API was not returning any restaurants, as you can see here.

Debug Log (Click to Expand)

com.crio.qeats.controller.RestaurantControllerDebugModuleHiddenTest1 > hiddenTest2() STANDARD_OUT
14:35:17.705 [Test worker] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - 1 mappings in <unknown>
14:35:17.722 [Test worker] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
14:35:17.727 [Test worker] DEBUG org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver - ControllerAdvice beans: 0 @ExceptionHandler, 1 ResponseBodyAdviceThis text will be hidden
14:35:17.980 [Test worker] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to public org.springframework.http.ResponseEntity<com.crio.qeats.exchanges.GetRestaurantsResponse> com.crio.qeats.controller.RestaurantController$MockitoMock$457067394.getRestaurants(com.crio.qeats.exchanges.GetRestaurantsRequest)
14:35:18.224 [Test worker] DEBUG org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor - Using 'application/json;charset=UTF-8', given [application/json;charset=UTF-8] and supported [application/json, application/*+json]
14:35:18.226 [Test worker] DEBUG org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor - Writing [GetRestaurantsResponse(restaurants=[])]
com.crio.qeats.controller.RestaurantControllerDebugModuleHiddenTest1 > hiddenTest2() FAILED
org.opentest4j.AssertionFailedError at

I have no idea why it is not returning any restaurants. The API call being made is to

I narrowed it down to my repository layer, where the method where it checks whether the restaurant is nearby and open fails for all restaurants. My local tests are passing successfully, my android app works fine but Postman and the hidden test fail.

The interesting thing is that the assessment passed when I ran it at midnight yesterday. I assume this is because all the restaurants in the database close after 11PM, and thus the assessment was not expecting any restaurants back.

I would still like to debug and check where my error is because this is obviously not the expected behaviour.

Hmm, weird.

The tests will be checking for data at specific time, so we can rule out the difference being the time at which the test is ran.

Just to clarify, your assessment was failing when you pushed during the day but the same code passed assessment when pushed at night, right?

I had pushed it once at around 8:30PM and the test failed. I later pushed it at around 11:45PM and it worked. I wasn’t doing any major logical changes (adding debug statements etc) during the time between these commits.

Anyways, I am not sure what happened because I ran the assessment again now (around 10PM) and it passed. So I indeed guess that maybe I made a minor change that made it pass or it was an assessment bug.

The problem is that Postman still returns no restaurants for that query. Just to be 100% clear, what is the expected output when a call is made to the this endpoint? Is the expected output 0 restaurants? If so then there is nothing wrong with my code, but I still don’t understand why I was failing the assessment yesterday because for both the assessment runs I was returning 0 restaurants.


No, Postman should be returning restaurants. Are you running the application using ./gradlew bootrun?

Can you check and tell me what all/where changes were made between the failing & passing assessment?