FileDocCategorySizeDatePackage
TestCruddyExtractor.javaAPI DocApache Poi 3.0.13259Mon Jan 01 18:56:12 GMT 2007org.apache.poi.hslf.extractor

TestCruddyExtractor

public class TestCruddyExtractor extends TestCase
Tests that the QuickButCruddyTextExtractor works correctly
author
Nick Burch (nick at torchbox dot com)

Fields Summary
private QuickButCruddyTextExtractor
te
String[]
allTheText
Constructors Summary
public TestCruddyExtractor()


        
		String dirname = System.getProperty("HSLF.testdata.path");
		String filename = dirname + "/basic_test_ppt_file.ppt";
		te = new QuickButCruddyTextExtractor(filename);
    
Methods Summary
public voidtestReadAsString()

		// Extract the text as a String
		String foundText = te.getTextAsString();

		// Turn the string array into a single string
		StringBuffer expectTextSB = new StringBuffer();
		for(int i=0; i<allTheText.length; i++) {
			expectTextSB.append(allTheText[i]);
			expectTextSB.append('\n");
		}
		String expectText = expectTextSB.toString();

		// Ensure they match
		assertEquals(expectText,foundText);
	
public voidtestReadAsVector()

		// Extract the text from the file as a vector
		Vector foundTextV = te.getTextAsVector();

		// Ensure they match
		assertEquals(allTheText.length,foundTextV.size());
		for(int i=0; i<allTheText.length; i++) {
			String foundText = (String)foundTextV.get(i);
			assertEquals(allTheText[i],foundText);
		}