@Test
  public void ethGetStorageLatestAtIndexZero() throws Exception {
    // Setup mocks to return a block
    final BlockDataGenerator gen = new BlockDataGenerator();
    final Address address = gen.address();
    final String mockStorage = "0x0000000000000000000000000000000000000000000000000000000000000001";
    when(blockchainQueries.getBlockchain()).thenReturn(blockchain);
    when(blockchainQueries.getBlockchain().getChainHead()).thenReturn(chainHead);
    final BlockHeader blockHeader = mock(BlockHeader.class);
    when(blockHeader.getBlockHash()).thenReturn(Hash.ZERO);
    when(chainHead.getBlockHeader()).thenReturn(blockHeader);
    when(blockchainQueries.storageAt(eq(address), eq(UInt256.ZERO), eq(Hash.ZERO)))
        .thenReturn(Optional.of(UInt256.fromHexString(mockStorage)));

    final String id = "88";
    final RequestBody body =
        RequestBody.create(
            "{\"jsonrpc\":\"2.0\",\"id\":"
                + Json.encode(id)
                + ",\"method\":\"eth_getStorageAt\", \"params\": [\""
                + address
                + "\",\""
                + UInt256.ZERO
                + "\",\"latest\"]}",
            JSON);

    try (final Response resp = client.newCall(buildPostRequest(body)).execute()) {
      assertThat(resp.code()).isEqualTo(200);
      // Check general format of result
      final String respBody = resp.body().string();
      final JsonObject json = new JsonObject(respBody);
      testHelper.assertValidJsonRpcResult(json, id);
      // Check result
      final String result = json.getString("result");
      assertThat(result)
          .isEqualTo("0x0000000000000000000000000000000000000000000000000000000000000001");
    }
  }
Tests that empty batch requests are treated as invalid requests as per
http://www.jsonrpc.org/specification#batch.
ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTest.java