### Question:
DebugTraceBlockByHash implements JsonRpcMethod { @Override public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { final Hash blockHash = requestContext.getRequiredParameter(0, Hash.class); final TraceOptions traceOptions = requestContext .getOptionalParameter(1, TransactionTraceParams.class) .map(TransactionTraceParams::traceOptions) .orElse(TraceOptions.DEFAULT); final Collection<DebugTraceTransactionResult> results = blockTracerSupplier .get() .trace(blockHash, new DebugOperationTracer(traceOptions)) .map(BlockTrace::getTransactionTraces) .map(DebugTraceTransactionResult::of) .orElse(null); return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), results); } DebugTraceBlockByHash(final Supplier<BlockTracer> blockTracerSupplier); @Override String getName(); @Override JsonRpcResponse response(final JsonRpcRequestContext requestContext);  }### Answer:
@Test public void shouldReturnCorrectResponse() { final Object[] params = new Object[] {blockHash}; final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", "debug_traceBlockByHash", params)); final TraceFrame traceFrame = new TraceFrame( 12, Optional.of("NONE"), Gas.of(45), Optional.of(Gas.of(56)), Gas.ZERO, 2, Optional.empty(), null, Wei.ZERO, Bytes.EMPTY, Bytes.EMPTY, Optional.empty(), Optional.empty(), Optional.empty(), null, Optional.empty(), Optional.empty(), Optional.empty(), 0, Optional.empty(), false, Optional.empty(), Optional.empty()); final TransactionProcessor.Result transaction1Result = mock(TransactionProcessor.Result.class); final TransactionProcessor.Result transaction2Result = mock(TransactionProcessor.Result.class); final TransactionTrace transaction1Trace = mock(TransactionTrace.class); final TransactionTrace transaction2Trace = mock(TransactionTrace.class); BlockTrace blockTrace = new BlockTrace(Arrays.asList(transaction1Trace, transaction2Trace)); when(transaction1Trace.getTraceFrames()).thenReturn(Arrays.asList(traceFrame)); when(transaction2Trace.getTraceFrames()).thenReturn(Arrays.asList(traceFrame)); when(transaction1Trace.getResult()).thenReturn(transaction1Result); when(transaction2Trace.getResult()).thenReturn(transaction2Result); when(transaction1Result.getOutput()).thenReturn(Bytes.fromHexString("1234")); when(transaction2Result.getOutput()).thenReturn(Bytes.fromHexString("1234")); when(blockTracer.trace(eq(blockHash), any())).thenReturn(Optional.of(blockTrace)); final JsonRpcSuccessResponse response = (JsonRpcSuccessResponse) debugTraceBlockByHash.response(request); final Collection<?> result = (Collection<?>) response.getResult(); assertThat(result).hasSize(2); }