TestVisioExtractorpublic class TestVisioExtractor extends TestCase
Fields Summary |
---|
private String | filename |
Methods Summary |
---|
protected void | setUp()
String dirname = System.getProperty("HDGF.testdata.path");
filename = dirname + "/Test_Visio-Some_Random_Text.vsd";
| public void | testCreation()Test the 3 different ways of creating one
VisioTextExtractor extractor;
extractor = new VisioTextExtractor(new FileInputStream(filename));
assertNotNull(extractor);
assertNotNull(extractor.getAllText());
assertEquals(3, extractor.getAllText().length);
extractor = new VisioTextExtractor(
new POIFSFileSystem(
new FileInputStream(filename)
)
);
assertNotNull(extractor);
assertNotNull(extractor.getAllText());
assertEquals(3, extractor.getAllText().length);
extractor = new VisioTextExtractor(
new HDGFDiagram(
new POIFSFileSystem(
new FileInputStream(filename)
)
)
);
assertNotNull(extractor);
assertNotNull(extractor.getAllText());
assertEquals(3, extractor.getAllText().length);
| public void | testExtraction()
VisioTextExtractor extractor =
new VisioTextExtractor(new FileInputStream(filename));
// Check the array fetch
String[] text = extractor.getAllText();
assertNotNull(text);
assertEquals(3, text.length);
assertEquals("Test View\n", text[0]);
assertEquals("I am a test view\n", text[1]);
assertEquals("Some random text, on a page\n", text[2]);
// And the all-in fetch
String textS = extractor.getText();
assertEquals("Test View\nI am a test view\nSome random text, on a page\n", textS);
| public void | testMain()
PrintStream oldOut = System.out;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream capture = new PrintStream(baos);
System.setOut(capture);
VisioTextExtractor.main(new String[] {filename});
// Put things back
System.setOut(oldOut);
// Check
capture.flush();
String text = baos.toString();
assertEquals("Test View\nI am a test view\nSome random text, on a page\n", text);
|
|