### Question:
GetRequest extends BaseKeyValueRequest<GetResponse> { @Override public GetResponse decode(final ByteBuf response, KeyValueChannelContext ctx) { ResponseStatus status = decodeStatus(response); long cas = cas(response); if (status.success()) { byte[] bytes = bodyAsBytes(response); byte[] content = bytes != null ? tryDecompression(bytes, datatype(response)) : Bytes.EMPTY_BYTE_ARRAY; int flags = extrasAsInt(response, 0, 0); return new GetResponse(status, content, cas, flags); } else { return new GetResponse(status, null, cas, 0); } } GetRequest(final String key, final Duration timeout, final CoreContext ctx,
                    final CollectionIdentifier collectionIdentifier, final RetryStrategy retryStrategy, final InternalSpan span); @Override ByteBuf encode(ByteBufAllocator alloc, int opaque, KeyValueChannelContext ctx); @Override GetResponse decode(final ByteBuf response, KeyValueChannelContext ctx); @Override boolean idempotent(); static final String OPERATION_NAME; }### Answer:
@Test void decodeSuccessfulResponse() { ByteBuf response = decodeHexDump(readResource( "get_response_success.txt", GetRequestTest.class )); GetRequest request = new GetRequest(null, TIMEOUT, CTX, null, RETRY, null); GetResponse decoded = request.decode(response, null); byte[] expected = ("{\"callsign\":\"AIRCALIN\",\"country\":\"France\"," + "\"iata\":\"SB\",\"icao\":\"ACI\",\"id\":139," + "\"name\":\"Air Caledonie International\",\"type\":\"airline\"}" ).getBytes(UTF_8); assertEquals(ResponseStatus.SUCCESS, decoded.status()); assertArrayEquals(expected, decoded.content()); assertEquals("2000000", Integer.toHexString(decoded.flags())); }
@Test void decodeNotFoundResponse() { ByteBuf response = decodeHexDump(readResource( "get_response_not_found.txt", GetRequestTest.class )); GetRequest request = new GetRequest(null, TIMEOUT, CTX, null, RETRY, null); GetResponse decoded = request.decode(response, null); assertEquals(ResponseStatus.NOT_FOUND, decoded.status()); assertNull(decoded.content()); assertEquals(0, decoded.flags()); }