Re: [xwiki-devs] [xwiki-notifications] r11747 - platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/java/com/xpn/xwiki/tool/doc
Jerome, You shouldn't name your test with Abstract as classes starting with Abstract are excluded from tests by default. Thanks -Vincent On Aug 11, 2008, at 12:38 PM, jvelociter (SVN) wrote:
Author: jvelociter Date: 2008-08-11 12:38:43 +0200 (Mon, 11 Aug 2008) New Revision: 11747
Added: platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/ java/com/xpn/xwiki/tool/doc/AbstractDocumentMojoTest.java Removed: platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/ java/com/xpn/xwiki/tool/doc/UpdateDocumentMojoTest.java Log: Renamed UpdateDocumentMojoTest to AbstractDocumentMojoTest to match the tested class
Copied: platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/ test/java/com/xpn/xwiki/tool/doc/AbstractDocumentMojoTest.java (from rev 11746, platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/ test/java/com/xpn/xwiki/tool/doc/UpdateDocumentMojoTest.java) =================================================================== --- platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/ java/com/xpn/xwiki/tool/doc/ AbstractDocumentMojoTest.java (rev 0) +++ platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/ java/com/xpn/xwiki/tool/doc/AbstractDocumentMojoTest.java 2008-08-11 10:38:43 UTC (rev 11747) @@ -0,0 +1,68 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package com.xpn.xwiki.tool.doc; + +import java.io.File; +import java.io.FileReader; +import java.net.URL; + +import com.xpn.xwiki.doc.XWikiDocument; + +import junit.framework.TestCase; + +/** + * Tests for {@link AbstractDocumentMojo}. + * + * @version $Id: $ + */ +public class AbstractDocumentMojoTest extends TestCase +{ + /** + * Test that a document loaded in memory from XML by the mojo then written back to XML does not lose any + * information/is not affected by the process + */ + public void testXMLDocumentLoading() throws Exception + { + AttachMojo mojo = new AttachMojo(); + + URL resURL = this.getClass().getResource("/ SampleWikiXMLDocument.input"); + File resourceFile = new File(resURL.getPath()); + FileReader fr = new FileReader(resourceFile); + char[] bytes = new char[(int) resourceFile.length()]; + fr.read(bytes); + String inputContent = new String(bytes); + + assertTrue(inputContent.contains("<class>")); + + XWikiDocument doc = mojo.loadFromXML(resourceFile); + assertEquals(doc.getName(), "Install"); + + File outputFile = File.createTempFile("output", "xml"); + mojo.writeToXML(doc, outputFile); + + fr = new FileReader(outputFile); + bytes = new char[(int) outputFile.length()]; + fr.read(bytes); + String outputContent = new String(bytes); + + // Check that we did not lose the class definition during the loading from XML/writing to XML process. + assertTrue(outputContent.contains("<class>")); + } +}
Deleted: platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/ test/java/com/xpn/xwiki/tool/doc/UpdateDocumentMojoTest.java =================================================================== --- platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/ java/com/xpn/xwiki/tool/doc/UpdateDocumentMojoTest.java 2008-08-11 08:15:58 UTC (rev 11746) +++ platform/xwiki-tools/trunk/xwiki-xmldoc-update-plugin/src/test/ java/com/xpn/xwiki/tool/doc/UpdateDocumentMojoTest.java 2008-08-11 10:38:43 UTC (rev 11747) @@ -1,68 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package com.xpn.xwiki.tool.doc; - -import java.io.File; -import java.io.FileReader; -import java.net.URL; - -import com.xpn.xwiki.doc.XWikiDocument; - -import junit.framework.TestCase; - -/** - * Tests for {@link AbstractDocumentMojo}. - * - * @version $Id: $ - */ -public class UpdateDocumentMojoTest extends TestCase -{ - /** - * Test that a document loaded in memory from XML by the mojo then written back to XML does not lose any - * information/is not affected by the process - */ - public void testXMLDocumentLoading() throws Exception - { - AttachMojo mojo = new AttachMojo(); - - URL resURL = this.getClass().getResource("/ SampleWikiXMLDocument.input"); - File resourceFile = new File(resURL.getPath()); - FileReader fr = new FileReader(resourceFile); - char[] bytes = new char[(int) resourceFile.length()]; - fr.read(bytes); - String inputContent = new String(bytes); - - assertTrue(inputContent.contains("<class>")); - - XWikiDocument doc = mojo.loadFromXML(resourceFile); - assertEquals(doc.getName(), "Install"); - - File outputFile = File.createTempFile("output", "xml"); - mojo.writeToXML(doc, outputFile); - - fr = new FileReader(outputFile); - bytes = new char[(int) outputFile.length()]; - fr.read(bytes); - String outputContent = new String(bytes); - - // Check that we did not lose the class definition during the loading from XML/writing to XML process. - assertTrue(outputContent.contains("<class>")); - } -}
_______________________________________________ notifications mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/notifications
participants (1)
-
Vincent Massol