@Test void readTree_with_IOException_test() throws IOException { ObjectMapper objectMapper = mock(ObjectMapper.class); when(objectMapper.readTree((byte[]) any())).thenThrow(IOException.class); byte[] value = new byte[0]; assertThatThrownBy(()-> JacksonUtil.readTree(objectMapper, value)).isInstanceOf(UncheckedIOException.class); }
public static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes) { try { return objectMapper.readTree(bytes); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } }
JacksonUtil { public static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes) { try { return objectMapper.readTree(bytes); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } }
JacksonUtil { public static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes) { try { return objectMapper.readTree(bytes); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } private  JacksonUtil(); }
JacksonUtil { public static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes) { try { return objectMapper.readTree(bytes); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } private  JacksonUtil(); static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes); static byte[] binaryValue(JsonNode jsonNode); }
JacksonUtil { public static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes) { try { return objectMapper.readTree(bytes); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } private  JacksonUtil(); static JsonNode readTree(ObjectMapper objectMapper, byte[] bytes); static byte[] binaryValue(JsonNode jsonNode);  }