### Question:
ExcelMatrixWriter implements IMatrixWriter { @Override public void write(String[] strings) { column = 0; sheet.createRow(row); for (String s : strings) { sheet.getRow(row).createCell(column); Cell cell = sheet.getRow(row).getCell(column); cell.setCellValue(s); column++; } row++; } ExcelMatrixWriter(String fileName, boolean useXlsx);  ExcelMatrixWriter(OutputStream outputStream, boolean useXlsx);  ExcelMatrixWriter(String fileName, boolean useXlsx, String sheetName);  ExcelMatrixWriter(OutputStream outputStream, boolean useXlsx, String sheetName); @Override void writeCells(SimpleCell[] cells); @Override void write(String[] strings); @Override void close(); @Override void flush();  }### Answer:
@Test public void testWrite() { try (ExcelMatrixWriter e = new ExcelMatrixWriter(new FileOutputStream(file), false, "someName")) { String[] cells = new String[10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { byte[] forString = new byte[32]; new Random().nextBytes(forString); cells[j] = new String(forString); } e.write(cells); } } catch (IOException ex) { fail(ex.getMessage()); } catch (Exception ex) { fail(ex.getMessage()); } try { WorkbookFactory.create(file); } catch (IOException e1) { fail(e1.getMessage()); } }
@Test public void testWriteXlsx() { try (ExcelMatrixWriter e = new ExcelMatrixWriter(new FileOutputStream(fileX), true, "someName")) { String[] cells = new String[10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { byte[] forString = new byte[32]; new Random().nextBytes(forString); cells[j] = new String(forString); } e.write(cells); } } catch (IOException ex) { fail(ex.getMessage()); } catch (Exception ex) { fail(ex.getMessage()); } try { WorkbookFactory.create(fileX); } catch (IOException e1) { fail(e1.getMessage()); } }