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;
/**
* 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";
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));
}
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
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
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;
* 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;
/**
* 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()));
}
}
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(
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
{
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
{