MacroModule { public void add(final XMLUtil util, final OdsDocument document, final String libraryNameSlash) throws IOException { document.addExtraFile(libraryNameSlash + this.name + ".xml", "text/xml", this.module(util)); } MacroModule(final String name, final String language, final CharSequence code); static MacroModule createBasic(final String name, final CharSequence code); void add(final XMLUtil util, final OdsDocument document, final String libraryNameSlash); void appendIndexLine(final XMLUtil util, final Appendable appendable);  }
@Test public void testAdd() throws IOException { final OdsDocument document = PowerMock.createMock(OdsDocument.class); final MacroModule module = new MacroModule("n", "l", "module content"); final Capture<byte[]> bs = Capture.newInstance(); PowerMock.resetAll(); document.addExtraFile(EasyMock.eq("slash/n.xml"), EasyMock.eq("text/xml"), EasyMock.capture(bs)); PowerMock.replayAll(); module.add(XMLUtil.create(), document, "slash/"); PowerMock.verifyAll(); Assert.assertEquals(XMLUtil.XML_PROLOG + "<!DOCTYPE script:module" + " PUBLIC \"- ".dtd\"><script:module xmlns:script=\"http: "script:name=\"n\" script:language=\"l\" script:moduleType=\"normal\">module " + "content</script:module>", new String(bs.getValue(), CharsetUtil.UTF_8)); }