ContentElement implements OdsElement { public void addAutoFilter(final AutoFilter autoFilter) { if (this.autoFilters == null) { this.autoFilters = new ArrayList<AutoFilter>(); } this.autoFilters.add(autoFilter); } ContentElement(final PositionUtil positionUtil, final XMLUtil xmlUtil,
                   final WriteUtil writeUtil, final DataStyles format,
                   final boolean libreOfficeMode, final StylesContainerImpl stylesContainer,
                   final Map<String, String> additionalNamespaceByPrefix); TableCellStyle addChildCellStyle(final TableCellStyle style, final CellType type); @Deprecated Table addTable(final String name, final int rowCapacity, final int columnCapacity); boolean addTable(final Table table); Table createTable(final String name, final int rowCapacity, final int columnCapacity); Table getLastTable(); StylesContainer getStyleTagsContainer(); Table getTable(final int tableIndex); Table getTable(final String name); int getTableCount(); List<Table> getTables(); @Override void write(final XMLUtil util, final ZipUTF8Writer writer); void writePreamble(final XMLUtil util, final ZipUTF8Writer writer); void writePostamble(final XMLUtil util, final ZipUTF8Writer writer); void writeEvents(final XMLUtil util, final ZipUTF8Writer writer); void addAutoFilter(final AutoFilter autoFilter); void addEvents(final ScriptEventListener... events); void addPilotTable(final PilotTable pilotTable);  }
@Test public void testAddAutoFilter() throws IOException { final ZipUTF8WriterMockHandler handler = ZipUTF8WriterMockHandler.create(); final ZipUTF8Writer writer = handler.getInstance(ZipUTF8Writer.class); final Table t = PowerMock.createMock(Table.class); PowerMock.resetAll(); EasyMock.expect(t.getName()).andReturn("t"); this.container .writeFontFaceDecls(EasyMock.eq(this.xmlUtil), EasyMock.isA(Appendable.class)); this.container .writeHiddenDataStyles(EasyMock.eq(this.xmlUtil), EasyMock.isA(Appendable.class)); this.container.writeContentAutomaticStyles(EasyMock.eq(this.xmlUtil), EasyMock.isA(Appendable.class)); PowerMock.replayAll(); final AutoFilter autoFilter = AutoFilter.builder("range", t, 1, 2, 3, 4).build(); this.content.writePreamble(this.xmlUtil, writer); this.content.addAutoFilter(autoFilter); this.content.writePostamble(this.xmlUtil, writer); PowerMock.verifyAll(); DomTester.assertEquals(PREAMBLE_BODY + "<office:spreadsheet>" + "<table:database-ranges>" + "<table:database-range table:name=\"range\" table:display-filter-buttons=\"true\" " + "table:target-range-address=\"t.C2:E4\"/>" + "</table:database-ranges></office:spreadsheet>" + POSTAMBLE_BODY, this.getString(handler)); }