### Question:
GetGenesis extends AbstractHandler implements Handler { @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get chain genesis details", tags = {TAG_V1_BEACON, TAG_VALIDATOR_REQUIRED}, description = "Retrieve details of the chain's genesis which can be used to identify chain.", responses = { @OpenApiResponse( status = RES_OK, content = @OpenApiContent(from = GetGenesisResponse.class)), @OpenApiResponse( status = RES_NOT_FOUND, description = "Chain genesis info is not yet known"), @OpenApiResponse(status = RES_INTERNAL_ERROR), }) @Override public void handle(@NotNull final Context ctx) throws Exception { final Optional<GenesisData> maybeData = getGenesisData(); if (maybeData.isEmpty()) { ctx.status(SC_NOT_FOUND); return; } ctx.result(jsonProvider.objectToJSON(new GetGenesisResponse(maybeData.get()))); } GetGenesis(final DataProvider dataProvider, final JsonProvider jsonProvider);   GetGenesis(final ChainDataProvider chainDataProvider, final JsonProvider jsonProvider); @OpenApi( path = ROUTE, method = HttpMethod.GET, summary = "Get chain genesis details", tags = {TAG_V1_BEACON, TAG_VALIDATOR_REQUIRED}, description = "Retrieve details of the chain's genesis which can be used to identify chain.", responses = { @OpenApiResponse( status = RES_OK, content = @OpenApiContent(from = GetGenesisResponse.class)), @OpenApiResponse( status = RES_NOT_FOUND, description = "Chain genesis info is not yet known"), @OpenApiResponse(status = RES_INTERNAL_ERROR), }) @Override void handle(@NotNull final Context ctx); static final String ROUTE; }### Answer:
@Test public void shouldReturnUnavailableWhenStoreNotAvailable() throws Exception { final GetGenesis handler = new GetGenesis(chainDataProvider, jsonProvider); when(chainDataProvider.isStoreAvailable()).thenReturn(false); handler.handle(context); verifyStatusCode(SC_NOT_FOUND); }
@Test public void shouldReturnGenesisInformation() throws Exception { final GetGenesis handler = new GetGenesis(chainDataProvider, jsonProvider); final UInt64 genesisTime = dataStructureUtil.randomUInt64(); final ForkInfo forkInfo = dataStructureUtil.randomForkInfo(); when(chainDataProvider.isStoreAvailable()).thenReturn(true); when(chainDataProvider.getGenesisTime()).thenReturn(genesisTime); when(chainDataProvider.getForkInfo()).thenReturn(new GetForkResponse(forkInfo)); handler.handle(context); final GetGenesisResponse response = getResponseObject(GetGenesisResponse.class); assertThat(response.data) .isEqualTo( new GenesisData( genesisTime, forkInfo.getGenesisValidatorsRoot(), Constants.GENESIS_FORK_VERSION)); }