@Test public void exportTest() throws Exception { SpreadsheetExporter exporter = new SpreadsheetExporter(); SpreadsheetExporter spy = spy(exporter); OutputStream stream = mock(OutputStream.class); Workbook workbook = mock(Workbook.class); when(spy.createNewWorkbook()).thenReturn(workbook); doNothing().when(spy).processMainSheet(anySetOf(String.class), anyListOf(Patient.class)); List<Patient> list = new LinkedList<>(); spy.export(new String[0], list, stream); verify(workbook, times(1)).write(stream); verify(stream, times(1)).flush(); }
public void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream) throws Exception { if (enabledFieldsArray == null || outputStream == null) { return; } Set<String> enabledFields = new HashSet<String>(Arrays.asList(enabledFieldsArray)); try { this.wBook = createNewWorkbook(); processMainSheet(enabledFields, patients); this.wBook.write(outputStream); outputStream.flush(); } finally { try { outputStream.close(); } catch (IOException ex) { } } }
SpreadsheetExporter { public void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream) throws Exception { if (enabledFieldsArray == null || outputStream == null) { return; } Set<String> enabledFields = new HashSet<String>(Arrays.asList(enabledFieldsArray)); try { this.wBook = createNewWorkbook(); processMainSheet(enabledFields, patients); this.wBook.write(outputStream); outputStream.flush(); } finally { try { outputStream.close(); } catch (IOException ex) { } } } }
SpreadsheetExporter { public void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream) throws Exception { if (enabledFieldsArray == null || outputStream == null) { return; } Set<String> enabledFields = new HashSet<String>(Arrays.asList(enabledFieldsArray)); try { this.wBook = createNewWorkbook(); processMainSheet(enabledFields, patients); this.wBook.write(outputStream); outputStream.flush(); } finally { try { outputStream.close(); } catch (IOException ex) { } } }  }
SpreadsheetExporter { public void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream) throws Exception { if (enabledFieldsArray == null || outputStream == null) { return; } Set<String> enabledFields = new HashSet<String>(Arrays.asList(enabledFieldsArray)); try { this.wBook = createNewWorkbook(); processMainSheet(enabledFields, patients); this.wBook.write(outputStream); outputStream.flush(); } finally { try { outputStream.close(); } catch (IOException ex) { } } }  void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream); }
SpreadsheetExporter { public void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream) throws Exception { if (enabledFieldsArray == null || outputStream == null) { return; } Set<String> enabledFields = new HashSet<String>(Arrays.asList(enabledFieldsArray)); try { this.wBook = createNewWorkbook(); processMainSheet(enabledFields, patients); this.wBook.write(outputStream); outputStream.flush(); } finally { try { outputStream.close(); } catch (IOException ex) { } } }  void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream);  }