### Question:
GetHealth implements Handler { @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node health", description = "Returns node health status in http status codes. Useful for load balancers.", tags = {TAG_V1_NODE}, responses = { @OpenApiResponse(status = RES_OK, description = "Node is ready"), @OpenApiResponse( status = RES_PARTIAL_CONTENT, description = "Node is syncing but can serve incomplete data"), @OpenApiResponse( status = RES_SERVICE_UNAVAILABLE, description = "Node not initialized or having issues") }) @Override public void handle(@NotNull final Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); if (!chainDataProvider.isStoreAvailable()) { ctx.status(SC_SERVICE_UNAVAILABLE); } else if (syncProvider.getSyncStatus().is_syncing) { ctx.status(SC_PARTIAL_CONTENT); } else { ctx.status(SC_OK); } } GetHealth(final DataProvider provider);   GetHealth(final SyncDataProvider syncProvider, final ChainDataProvider chainDataProvider); @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get node health", description = "Returns node health status in http status codes. Useful for load balancers.", tags = {TAG_V1_NODE}, responses = { @OpenApiResponse(status = RES_OK, description = "Node is ready"), @OpenApiResponse( status = RES_PARTIAL_CONTENT, description = "Node is syncing but can serve incomplete data"), @OpenApiResponse( status = RES_SERVICE_UNAVAILABLE, description = "Node not initialized or having issues") }) @Override void handle(@NotNull final Context ctx); static final String ROUTE; }### Answer:
@Test public void shouldReturnSyncingStatusWhenSyncing() throws Exception { final GetHealth handler = new GetHealth(syncDataProvider, chainDataProvider); when(chainDataProvider.isStoreAvailable()).thenReturn(true); when(syncService.getSyncStatus()).thenReturn(getSyncStatus(true, 1, 10, 10)); handler.handle(context); verifyCacheStatus(CACHE_NONE); verifyStatusCode(SC_PARTIAL_CONTENT); }
@Test public void shouldReturnOkWhenInSyncAndReady() throws Exception { final GetHealth handler = new GetHealth(syncDataProvider, chainDataProvider); when(chainDataProvider.isStoreAvailable()).thenReturn(true); when(syncService.getSyncStatus()).thenReturn(getSyncStatus(false, 1, 10, 10)); handler.handle(context); verifyCacheStatus(CACHE_NONE); verifyStatusCode(SC_OK); }
@Test public void shouldReturnUnavailableWhenStoreNotAvailable() throws Exception { final GetHealth handler = new GetHealth(syncDataProvider, chainDataProvider); when(chainDataProvider.isStoreAvailable()).thenReturn(false); handler.handle(context); verifyCacheStatus(CACHE_NONE); verifyStatusCode(SC_SERVICE_UNAVAILABLE); }