### Question:
GetSyncing implements Handler { @OpenApi( deprecated = true, path = ROUTE, method = HttpMethod.GET, summary = "Get synchronization status.", tags = {TAG_NODE}, description = "Returns an object with data about the synchronization status, or false if not synchronizing. " + "Replaced by standard api endpoint `/eth/v1/node/syncing`.", responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingStatus.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(Context ctx) throws Exception { ctx.header(CACHE_CONTROL, CACHE_NONE); final SyncingStatus syncingStatus = syncDataProvider.getSyncStatus(); ctx.result(jsonProvider.objectToJSON(syncingStatus)); } GetSyncing(SyncDataProvider syncDataProvider, JsonProvider jsonProvider); @OpenApi( deprecated = true, path = ROUTE, method = HttpMethod.GET, summary = "Get synchronization status.", tags = {TAG_NODE}, description = "Returns an object with data about the synchronization status, or false if not synchronizing. " + "Replaced by standard api endpoint `/eth/v1/node/syncing`.", responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = SyncingStatus.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override void handle(Context ctx); static final String ROUTE; }### Answer:
@Test public void shouldReturnTrueWhenSyncing() throws Exception { final boolean isSyncing = true; final UInt64 startSlot = UInt64.ONE; final UInt64 currentSlot = UInt64.valueOf(5); final UInt64 highestSlot = UInt64.valueOf(10); final tech.pegasys.teku.sync.SyncingStatus syncingStatus = new tech.pegasys.teku.sync.SyncingStatus( isSyncing, currentSlot, Optional.of(startSlot), Optional.of(highestSlot)); final GetSyncing handler = new GetSyncing(syncDataProvider, jsonProvider); final SyncingStatus expectedResponse = new SyncingStatus(true, new SyncStatus(startSlot, currentSlot, highestSlot)); when(syncService.getSyncStatus()).thenReturn(syncingStatus); handler.handle(context); verify(context).result(jsonProvider.objectToJSON(expectedResponse)); verify(context).header(Header.CACHE_CONTROL, CACHE_NONE); }
@Test public void shouldReturnFalseWhenNotSyncing() throws Exception { final boolean isSyncing = false; final tech.pegasys.teku.sync.SyncingStatus syncingStatus = new tech.pegasys.teku.sync.SyncingStatus(isSyncing, null); final SyncingStatus expectedResponse = new SyncingStatus(false, new SyncStatus(null, null, null)); final GetSyncing handler = new GetSyncing(syncDataProvider, jsonProvider); when(syncService.getSyncStatus()).thenReturn(syncingStatus); handler.handle(context); verify(context).result(jsonProvider.objectToJSON(expectedResponse)); verify(context).header(Header.CACHE_CONTROL, CACHE_NONE); }