### Question:
GetPeerId implements Handler { @OpenApi( deprecated = true, path = ROUTE, method = HttpMethod.GET, summary = "Get the node PeerId.", tags = {TAG_NETWORK}, description = "Returns the beacon node's base58-encoded PeerId." + " Replaced by standard api endpoint `/eth/v1/node/identity`.", responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = String.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(network.getNodeIdAsBase58())); } GetPeerId(NetworkDataProvider network, JsonProvider jsonProvider); @OpenApi( deprecated = true, path = ROUTE, method = HttpMethod.GET, summary = "Get the node PeerId.", tags = {TAG_NETWORK}, description = "Returns the beacon node's base58-encoded PeerId." + " Replaced by standard api endpoint `/eth/v1/node/identity`.", responses = { @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = String.class)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override void handle(Context ctx); static final String ROUTE; }### Answer:
@Test public void shouldReturnPeerId() throws Exception { NetworkDataProvider network = new NetworkDataProvider(eth2Network); final PeerId peerId1 = new PeerId(PeerId.random().getBytes()); final NodeId nodeId1 = new LibP2PNodeId(peerId1); final GetPeerId handler = new GetPeerId(network, jsonProvider); when(eth2Network.getNodeId()).thenReturn(nodeId1); handler.handle(context); verify(context).header(Header.CACHE_CONTROL, CACHE_NONE); verify(context).result(jsonProvider.objectToJSON(nodeId1.toBase58())); }