### Question:
StaticHexRegexDataHandler extends HexRegexDataHandler { @Override public Optional<byte[]> handle(final byte[] data) { final String encoded = BaseEncoding.base16().encode(data); final boolean matches = hexRegex.matcher(encoded).matches(); if (matches) { return Optional.of(base16().decode(responseData.toUpperCase())); } else { return Optional.empty(); } } StaticHexRegexDataHandler(final String hexRegex,
                                     final String responseData); @Override Optional<byte[]> handle(final byte[] data);  }### Answer:
@Test public void testHandle() { final Optional<byte[]> handleResult = dataHandler.handle(DEFAULT_TEST_DATA); assertThat(handleResult, is(optionalWithValue(equalTo(base16().decode(RESPONSE_DATA))))); }
@Test public void testHandle_emptyResult() { final Optional<byte[]> handleResult = dataHandler.handle(EMPTY_RESULT_TEST_DATA); assertThat(handleResult, emptyOptional()); }