@Test public void reportGenerator_NoError() { AROTraceData results = new AROTraceData(); results.setSuccess(true); try { when(filereader.createFile(any(String.class))).thenReturn(folder.newFile("abc.json")); } catch (IOException e) { e.printStackTrace(); } boolean testResult = jsonreport.reportGenerator("abc.json", results); assertTrue(testResult); }
@Override public boolean reportGenerator(String resultFilePath, AROTraceData results) { if (resultFilePath == null || results == null) { return false; } ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(); try { mapper.writeValue(filereader.createFile(resultFilePath), results); return true; } catch (JsonGenerationException e) { LOGGER.error(e.getMessage()); } catch (JsonMappingException e) { LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error(e.getMessage()); } return false; }
JSonReportImpl implements IReport { @Override public boolean reportGenerator(String resultFilePath, AROTraceData results) { if (resultFilePath == null || results == null) { return false; } ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(); try { mapper.writeValue(filereader.createFile(resultFilePath), results); return true; } catch (JsonGenerationException e) { LOGGER.error(e.getMessage()); } catch (JsonMappingException e) { LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error(e.getMessage()); } return false; } }
JSonReportImpl implements IReport { @Override public boolean reportGenerator(String resultFilePath, AROTraceData results) { if (resultFilePath == null || results == null) { return false; } ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(); try { mapper.writeValue(filereader.createFile(resultFilePath), results); return true; } catch (JsonGenerationException e) { LOGGER.error(e.getMessage()); } catch (JsonMappingException e) { LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error(e.getMessage()); } return false; }  }
JSonReportImpl implements IReport { @Override public boolean reportGenerator(String resultFilePath, AROTraceData results) { if (resultFilePath == null || results == null) { return false; } ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(); try { mapper.writeValue(filereader.createFile(resultFilePath), results); return true; } catch (JsonGenerationException e) { LOGGER.error(e.getMessage()); } catch (JsonMappingException e) { LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error(e.getMessage()); } return false; }  @Override boolean reportGenerator(String resultFilePath, AROTraceData results); }
JSonReportImpl implements IReport { @Override public boolean reportGenerator(String resultFilePath, AROTraceData results) { if (resultFilePath == null || results == null) { return false; } ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(); try { mapper.writeValue(filereader.createFile(resultFilePath), results); return true; } catch (JsonGenerationException e) { LOGGER.error(e.getMessage()); } catch (JsonMappingException e) { LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error(e.getMessage()); } return false; }  @Override boolean reportGenerator(String resultFilePath, AROTraceData results);  }