ContentElement implements OdsElement { public void addEvents(final ScriptEventListener... events) { this.scriptEvents.addAll(Arrays.asList(events)); } 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 testAddEvents() throws IOException { final ZipUTF8WriterMockHandler handler = ZipUTF8WriterMockHandler.create(); final ZipUTF8Writer writer = handler.getInstance(ZipUTF8Writer.class); PowerMock.resetAll(); 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(); this.content.addEvents(ScriptEventListener.create(ScriptEvent.ON_LOAD, "func")); this.content.writePreamble(this.xmlUtil, writer); this.content.writePostamble(this.xmlUtil, writer); DomTester.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + CONTENT_OPEN_TAG + "<office:scripts><office:event-listeners><script:event-listener script:language=\"ooo:script\" script:event-name=\"dom:load\" xlink:href=\"vnd.sun.star.script:func?language=Basic&amp;location=document\" xlink:type=\"simple\"/></office:event-listeners></office:scripts><office:automatic-styles></office:automatic-styles><office:body><office:spreadsheet></office:spreadsheet>" + POSTAMBLE_BODY, this.getString(handler)); }