### Question:
CreateExcelSpreadsheetAnalyzer extends AbstractOutputWriterAnalyzer implements HasLabelAdvice { @Initialize public void initTempFile() throws Exception { if (_targetFile == null) { if (columnToBeSortedOn != null) { _targetFile = File.createTempFile("csv_file_analyzer", ".csv"); isTempFile = true; } else { _targetFile = file; } } }  @Initialize void initTempFile(); @Override String getSuggestedLabel(); @Validate void validate(); @Override void configureForFilterOutcome(final AnalysisJobBuilder ajb, final FilterDescriptor<?, ?> descriptor,
            final String categoryName); @Override void configureForTransformedData(final AnalysisJobBuilder ajb, final TransformerDescriptor<?> descriptor); @Override OutputWriter createOutputWriter(); void setFile(final File file); void setSheetName(final String sheetName); @Close void close(); static final String PROPERTY_FILE; static final String PROPERTY_SHEET_NAME; static final String PROPERTY_OVERWRITE_SHEET_IF_EXISTS; }### Answer:
@Test public void testCustomColumnHeaders() throws Exception { final String filename = "target/exceltest-customcolumnheaders.xlsx"; final CreateExcelSpreadsheetAnalyzer analyzer = new CreateExcelSpreadsheetAnalyzer(); final InputColumn<String> stringColumn = new MockInputColumn<>("StringColumn"); final InputColumn<Integer> integerColumn = new MockInputColumn<>("IntegerColumn"); generatedFile = new File(filename); analyzer.file = generatedFile; analyzer.initTempFile(); assertNotNull(analyzer.file); analyzer.sheetName = "foo"; analyzer.columns = new InputColumn<?>[2]; analyzer.columns[0] = stringColumn; analyzer.columns[1] = integerColumn; analyzer.fields = new String[2]; analyzer.fields[0] = "CustomNameForStringColumn"; analyzer.fields[1] = "CustomNameForIntegerColumn"; analyzer.init(); final InputRow[] rows = new InputRow[13]; rows[0] = new MockInputRow().put(stringColumn, "row00").put(integerColumn, 7); rows[1] = new MockInputRow().put(stringColumn, "row01").put(integerColumn, 9); rows[2] = new MockInputRow().put(stringColumn, "row02").put(integerColumn, 2); rows[3] = new MockInputRow().put(stringColumn, "row03").put(integerColumn, 3); rows[4] = new MockInputRow().put(stringColumn, "row04").put(integerColumn, 4); rows[5] = new MockInputRow().put(stringColumn, "row05").put(integerColumn, 12); rows[6] = new MockInputRow().put(stringColumn, "row06").put(integerColumn, 6); rows[7] = new MockInputRow().put(stringColumn, "row07").put(integerColumn, 0); rows[8] = new MockInputRow().put(stringColumn, "row08").put(integerColumn, 8); rows[9] = new MockInputRow().put(stringColumn, "row09").put(integerColumn, 1); rows[10] = new MockInputRow().put(stringColumn, "row10").put(integerColumn, 10); rows[11] = new MockInputRow().put(stringColumn, "row11").put(integerColumn, 11); rows[12] = new MockInputRow().put(stringColumn, "row12").put(integerColumn, 5); for (int i = 0; i < rows.length; i++) { analyzer.run(rows[i], i); } analyzer.getResult(); final ExcelDatastore outputDatastore = new ExcelDatastore(filename, new FileResource(analyzer.file), analyzer.file.getAbsolutePath()); try (UpdateableDatastoreConnection outputDatastoreConnection = outputDatastore.openConnection()) { final List<String> columnNames = outputDatastoreConnection.getSchemaNavigator().getDefaultSchema().getTableByName(analyzer.sheetName) .getColumnNames(); assertEquals(2, columnNames.size()); assertEquals("CustomNameForStringColumn", columnNames.get(0)); assertEquals("CustomNameForIntegerColumn", columnNames.get(1)); } }