### Question:
GetListenAddresses implements Handler { @OpenApi( deprecated = true, path = ROUTE, method = HttpMethod.GET, summary = "Get the addresses the client's libp2p service is listening on.", tags = {TAG_NETWORK}, description = "Returns the list of addresses that the client's libp2p service is listening on." + " Replaced by standard api endpoint `/eth/v1/node/identity`.", responses = { @OpenApiResponse( status = RES_OK, content = @OpenApiContent(from = String.class, isArray = true)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override public void handle(@NotNull Context ctx) throws Exception { ctx.header(Header.CACHE_CONTROL, CACHE_NONE); ctx.result(jsonProvider.objectToJSON(network.getListeningAddresses())); } GetListenAddresses(final NetworkDataProvider network, final JsonProvider jsonProvider); @OpenApi( deprecated = true, path = ROUTE, method = HttpMethod.GET, summary = "Get the addresses the client's libp2p service is listening on.", tags = {TAG_NETWORK}, description = "Returns the list of addresses that the client's libp2p service is listening on." + " Replaced by standard api endpoint `/eth/v1/node/identity`.", responses = { @OpenApiResponse( status = RES_OK, content = @OpenApiContent(from = String.class, isArray = true)), @OpenApiResponse(status = RES_INTERNAL_ERROR) }) @Override void handle(@NotNull Context ctx); static final String ROUTE; }### Answer:
@Test public void shouldReturnListenerAddressList() throws Exception { final NetworkDataProvider networkDataProvider = mock(NetworkDataProvider.class); final GetListenAddresses handler = new GetListenAddresses(networkDataProvider, jsonProvider); final List<String> addresses = List.of("/ip4/127.0.0.1/tcp/9000"); final String expected = jsonProvider.objectToJSON(addresses); when(networkDataProvider.getListeningAddresses()).thenReturn(addresses); handler.handle(context); verify(context).result(expected); }