RowsFlusher implements OdsAsyncFlusher { @Override public void flushInto(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { for (final TableRowImpl row : this.rows) { if (row == null) { throw new IllegalArgumentException(); } row.appendXMLToTable(xmlUtil, writer); } Collections.fill(this.rows, null); } RowsFlusher(final List<TableRowImpl> rows); @Override void flushInto(final XMLUtil xmlUtil, final ZipUTF8Writer writer); @Override boolean isEnd();  }
@Test public void flushIntoEmptyList() throws Exception { final List<TableRowImpl> rows = Collections.emptyList(); PowerMock.resetAll(); PowerMock.replayAll(); final OdsAsyncFlusher flusher = new RowsFlusher(rows); flusher.flushInto(this.util, this.w); PowerMock.verifyAll(); }
@Test public void flushInto() throws Exception { final TableRowImpl r1 = PowerMock.createMock(TableRowImpl.class); final TableRowImpl r2 = PowerMock.createMock(TableRowImpl.class); final List<TableRowImpl> rows = Arrays.asList(r1, r2); PowerMock.resetAll(); r1.appendXMLToTable(this.util, this.w); r2.appendXMLToTable(this.util, this.w); PowerMock.replayAll(); final OdsAsyncFlusher flusher = new RowsFlusher(rows); flusher.flushInto(this.util, this.w); PowerMock.verifyAll(); }
@Test(expected = IllegalArgumentException.class) public void flushIntoNullRow() throws Exception { final List<TableRowImpl> rows = new ArrayList<TableRowImpl>(); rows.add(null); PowerMock.resetAll(); PowerMock.replayAll(); final OdsAsyncFlusher flusher = new RowsFlusher(rows); flusher.flushInto(this.util, this.w); PowerMock.verifyAll(); }