poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1496697 - in /poi/trunk/src/scratchpad/testcases/org/apache/poi: hslf/extractor/ hslf/usermodel/ hsmf/ hsmf/extractor/ hwpf/converter/
Date Wed, 26 Jun 2013 00:49:42 GMT
Author: nick
Date: Wed Jun 26 00:49:41 2013
New Revision: 1496697

URL: http://svn.apache.org/r1496697
Log:
Convert classes with a assertContains method to using the new POITestCase common parent class,
which has it there

Modified:
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java?rev=1496697&r1=1496696&r2=1496697&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java Wed
Jun 26 00:49:41 2013
@@ -24,6 +24,7 @@ import java.util.List;
 import junit.framework.TestCase;
 
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITestCase;
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.model.OLEShape;
 import org.apache.poi.hslf.usermodel.SlideShow;
@@ -36,10 +37,8 @@ import org.apache.poi.util.IOUtils;
 
 /**
  * Tests that the extractor correctly gets the text out of our sample file
- *
- * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestExtractor extends TestCase {
+public final class TestExtractor extends POITestCase {
    /** Extractor primed on the 2 page basic test data */
    private PowerPointExtractor ppe;
    private static final String expectText = "This is a test title\nThis is a test subtitle\nThis
is on page 1\nThis is the title on page 2\nThis is page two\nIt has several blocks of text\nNone
of them have formatting\n";
@@ -58,12 +57,6 @@ public final class TestExtractor extends
       ppe2 = new PowerPointExtractor(slTests.openResourceAsStream("with_textbox.ppt"));
    }
 
-   private static void assertContains(String haystack, String needle) {
-      assertContains(
-            "Unable to find expected text '" + needle + "' in text:\n" + haystack,
-            haystack, needle
-      );
-   }
    private static void assertContains(String reason, String haystack, String needle) {
       assertTrue(reason, haystack.contains(needle));
    }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java?rev=1496697&r1=1496696&r2=1496697&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
Wed Jun 26 00:49:41 2013
@@ -21,23 +21,21 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 
-import junit.framework.TestCase;
-
+import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITestCase;
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.model.Slide;
 import org.apache.poi.hslf.model.TextBox;
 import org.apache.poi.hslf.model.TextRun;
 import org.apache.poi.hslf.record.Record;
 import org.apache.poi.hslf.record.SlideListWithText;
-import org.apache.poi.POIDataSamples;
 
 /**
  * Test that the friendly getters and setters on RichTextRun
  *  behave as expected.
  * (model.TestTextRun tests the other functionality)
- * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestRichTextRun extends TestCase {
+public final class TestRichTextRun extends POITestCase {
    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
    // SlideShow primed on the test data
@@ -77,12 +75,6 @@ public final class TestRichTextRun exten
       ssChinese = new SlideShow(hssChinese);
 	}
 
-   private static void assertContains(String haystack, String needle) {
-      assertTrue(
-            "Unable to find expected text '" + needle + "' in text:\n" + haystack,
-            haystack.contains(needle)
-      );
-   }
 	/**
 	 * Test the stuff about getting/setting bold
 	 *  on a non rich text run

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java?rev=1496697&r1=1496696&r2=1496697&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java Wed
Jun 26 00:49:41 2013
@@ -25,9 +25,8 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.TimeZone;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITestCase;
 import org.apache.poi.hsmf.dev.HSMFDump;
 import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@@ -36,7 +35,7 @@ import org.apache.poi.poifs.filesystem.P
  * Tests that we can read fixed sized properties, as well as variable
  *  ones, for example Submission Dates
  */
-public final class TestFixedSizedProperties extends TestCase {
+public final class TestFixedSizedProperties extends POITestCase {
 	protected static final String messageSucceeds = "53784_succeeds.msg";
 	protected static final String messageFails = "53784_fails.msg";
 	private MAPIMessage mapiMessageSucceeds;
@@ -104,18 +103,11 @@ public final class TestFixedSizedPropert
    /**
     * TODO Work out why the Fri 22nd vs Monday 25th problem is occurring and fix
     */
-	public void DISABLEDtestClientSubmitTime() throws Exception {
-	   SimpleDateFormat f = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss");
-	   f.setTimeZone(TimeZone.getTimeZone("GMT"));
-
-	   Calendar clientSubmitTime = mapiMessageSucceeds.getMessageDate();
-	   assertEquals("Fri, 22 Jun 2012 18:32:54", f.format(clientSubmitTime.getTime()));
-	}
+   public void DISABLEDtestClientSubmitTime() throws Exception {
+       SimpleDateFormat f = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss");
+       f.setTimeZone(TimeZone.getTimeZone("GMT"));
 
-	private static void assertContains(String haystack, String needle) {
-      if (haystack.indexOf(needle) > -1) {
-         return;
-      }
-      fail("'" + needle + "' wasn't found in '" + haystack + "'");
+       Calendar clientSubmitTime = mapiMessageSucceeds.getMessageDate();
+       assertEquals("Fri, 22 Jun 2012 18:32:54", f.format(clientSubmitTime.getTime()));
    }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java?rev=1496697&r1=1496696&r2=1496697&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/extractor/TestOutlookTextExtractor.java
Wed Jun 26 00:49:41 2013
@@ -24,28 +24,20 @@ import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITestCase;
 import org.apache.poi.hsmf.MAPIMessage;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
  * Tests to verify that the text extractor works
  */
-public final class TestOutlookTextExtractor extends TestCase {
+public final class TestOutlookTextExtractor extends POITestCase {
    private POIDataSamples samples;
 
-	public TestOutlookTextExtractor() throws IOException {
-        samples = POIDataSamples.getHSMFInstance();
-	}
-	
-	private void assertContains(String haystack, String needle) {
-	   if(haystack.indexOf(needle) > -1) {
-	      return;
-	   }
-	   fail("'" + needle + "' wasn't found in '" + haystack + "'");
-	}
+   public TestOutlookTextExtractor() throws IOException {
+       samples = POIDataSamples.getHSMFInstance();
+   }
 	
    public void testQuick() throws Exception {
       POIFSFileSystem simple = new POIFSFileSystem(

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java?rev=1496697&r1=1496696&r2=1496697&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToFoConverter.java
Wed Jun 26 00:49:41 2013
@@ -27,26 +27,15 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITestCase;
 import org.apache.poi.hwpf.HWPFDocument;
 
 /**
  * Test cases for {@link WordToFoConverter}
- * 
- * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
  */
-public class TestWordToFoConverter extends TestCase
+public class TestWordToFoConverter extends POITestCase
 {
-    private static void assertContains( String result, final String substring )
-    {
-        if ( !result.contains( substring ) )
-            fail( "Substring \"" + substring
-                    + "\" not found in the following string: \"" + result
-                    + "\"" );
-    }
-
     private static String getFoText( final String sampleFileName )
             throws Exception
     {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java?rev=1496697&r1=1496696&r2=1496697&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
Wed Jun 26 00:49:41 2013
@@ -28,25 +28,16 @@ import javax.xml.transform.stream.Stream
 import junit.framework.TestCase;
 
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITestCase;
 import org.apache.poi.hwpf.HWPFDocument;
 import org.apache.poi.hwpf.usermodel.PictureType;
 import org.w3c.dom.Document;
 
 /**
  * Test cases for {@link WordToHtmlConverter}
- * 
- * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com)
  */
-public class TestWordToHtmlConverter extends TestCase
+public class TestWordToHtmlConverter extends POITestCase
 {
-    private static void assertContains( String result, final String substring )
-    {
-        if ( !result.contains( substring ) )
-            fail( "Substring \"" + substring
-                    + "\" not found in the following string: \"" + result
-                    + "\"" );
-    }
-
     private static String getHtmlText( final String sampleFileName )
             throws Exception
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message