@Test public void processMainSheet() throws Exception { SpreadsheetExporter exporter = new SpreadsheetExporter(); SpreadsheetExporter spy = spy(exporter); Workbook workbook = mock(Workbook.class); SheetAssembler assembler = mock(SheetAssembler.class); Sheet sheet = mock(Sheet.class); spy.wBook = workbook; doReturn(sheet).when(workbook).createSheet(anyString()); doReturn(assembler).when(spy).runAssembler(anySetOf(String.class), anyListOf(Patient.class)); doNothing().when(spy).commit(any(DataSection.class), any(Sheet.class)); doNothing().when(spy).freezeHeader(anyShort(), any(Sheet.class)); spy.processMainSheet(anySetOf(String.class), anyListOf(Patient.class)); Assert.assertTrue(exporter.sheets.containsValue(sheet)); verify(spy, atLeastOnce()).commit(any(DataSection.class), any(Sheet.class)); verify(spy, atLeastOnce()).freezeHeader(anyShort(), any(Sheet.class)); }
protected void processMainSheet(Set<String> enabledFields, List<Patient> patients) throws Exception { String sheetName = "main"; Sheet sheet = this.wBook.createSheet("Patient Sheet"); this.sheets.put(sheetName, sheet); SheetAssembler assembler = runAssembler(enabledFields, patients); commit(assembler.getAssembled(), sheet); freezeHeader(assembler.getHeaderHeight().shortValue(), sheet); }
SpreadsheetExporter { protected void processMainSheet(Set<String> enabledFields, List<Patient> patients) throws Exception { String sheetName = "main"; Sheet sheet = this.wBook.createSheet("Patient Sheet"); this.sheets.put(sheetName, sheet); SheetAssembler assembler = runAssembler(enabledFields, patients); commit(assembler.getAssembled(), sheet); freezeHeader(assembler.getHeaderHeight().shortValue(), sheet); } }
SpreadsheetExporter { protected void processMainSheet(Set<String> enabledFields, List<Patient> patients) throws Exception { String sheetName = "main"; Sheet sheet = this.wBook.createSheet("Patient Sheet"); this.sheets.put(sheetName, sheet); SheetAssembler assembler = runAssembler(enabledFields, patients); commit(assembler.getAssembled(), sheet); freezeHeader(assembler.getHeaderHeight().shortValue(), sheet); }  }
SpreadsheetExporter { protected void processMainSheet(Set<String> enabledFields, List<Patient> patients) throws Exception { String sheetName = "main"; Sheet sheet = this.wBook.createSheet("Patient Sheet"); this.sheets.put(sheetName, sheet); SheetAssembler assembler = runAssembler(enabledFields, patients); commit(assembler.getAssembled(), sheet); freezeHeader(assembler.getHeaderHeight().shortValue(), sheet); }  void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream); }
SpreadsheetExporter { protected void processMainSheet(Set<String> enabledFields, List<Patient> patients) throws Exception { String sheetName = "main"; Sheet sheet = this.wBook.createSheet("Patient Sheet"); this.sheets.put(sheetName, sheet); SheetAssembler assembler = runAssembler(enabledFields, patients); commit(assembler.getAssembled(), sheet); freezeHeader(assembler.getHeaderHeight().shortValue(), sheet); }  void export(String[] enabledFieldsArray, List<Patient> patients, OutputStream outputStream);  }