### Question:
ParserWrapper implements Parser { @Override public Long getLong() throws MatchbookSDKParsingException { if (isNotNullValue()) { try { return jsonParser.getValueAsLong(); } catch (IOException e) { throw new MatchbookSDKParsingException(e); } } return null; } ParserWrapper(JsonFactory jsonFactory, InputStream inputStream); @Override boolean hasCurrentToken(); @Override boolean isEndOfObject(); @Override boolean isEndOfArray(); @Override void moveToNextToken(); @Override void moveToNextValue(); @Override void skipChildren(); @Override String getFieldName(); @Override Boolean getBoolean(); @Override String getString(); @Override Integer getInteger(); @Override Long getLong(); @Override Double getDouble(); @Override BigDecimal getDecimal(); @Override Instant getInstant(); @Override T getEnum(Class<T> enumClass); @Override void close();  }### Answer:
@Test @DisplayName("Read long value") void getLongTest() throws IOException { Long expectedResult = 42L; when(jsonParser.getValueAsLong()).thenReturn(expectedResult); when(jsonParser.hasToken(JsonToken.VALUE_NULL)).thenReturn(false); Long result = unit.getLong(); assertThat(result).isNotNull(); assertThat(result).isEqualTo(expectedResult); }
@Test @DisplayName("Read null long value") void getLongNullTest() { when(jsonParser.hasToken(JsonToken.VALUE_NULL)).thenReturn(true); Long result = unit.getLong(); assertThat(result).isNull(); }
@Test @DisplayName("Exception reading long value") void getLongFailedTest() throws IOException { doThrow(IOException.class).when(jsonParser).getValueAsLong(); when(jsonParser.hasToken(JsonToken.VALUE_NULL)).thenReturn(false); assertThatExceptionOfType(MatchbookSDKParsingException.class) .isThrownBy(() -> unit.getLong()); }