### Question:
PostmanService { public void parse(JsonParser parser, NewmanParsingResult result) throws IOException { if (!parser.isClosed() && parser.nextToken() == JsonToken.START_OBJECT) { log.debug("[json] JSON stream contains a root object: parsing the Newman report"); parseRootObject(parser, result); } else { throw new IOException("JSON stream does not contain a root object: no Newman report to parse"); } }  void parse(JsonParser parser, NewmanParsingResult result); List<ExecutedScenario> postProcess(Run run, NewmanParsingResult result, String newmanReportPath, AtomicInteger requestPosition); void deleteTempFiles(NewmanParsingResult newmanParsingResult); static final String FOLDER_DELIMITER; }### Answer:
@Test public void parse_should_throw_exception_when_malformed_json() throws IOException { when(Boolean.valueOf(jsonParser.isClosed())).thenReturn(Boolean.FALSE); when(jsonParser.nextToken()).thenReturn(JsonToken.START_ARRAY); assertThrows(IOException.class, () -> cut.parse(jsonParser, null)); }
@Test public void parse_should_throw_exception_when_closed_stream() throws IOException { when(Boolean.valueOf(jsonParser.isClosed())).thenReturn(Boolean.TRUE); assertThrows(IOException.class, () -> cut.parse(jsonParser, null)); }