|
TestEmail |
|
1 /* 2 * TestEmail.java 3 * 4 * Copyright (c) 1998-2001, The University of Sheffield. 5 * 6 * This file is part of GATE (see http://gate.ac.uk/), and is free 7 * software, licenced under the GNU Library General Public License, 8 * Version 2, June 1991 (in the distribution as file licence.html, 9 * and also available at http://gate.ac.uk/gate/licence.html). 10 * 11 * Cristian URSU, 7/Aug/2000 12 * 13 * $Id: TestEmail.java,v 1.20 2001/10/30 12:45:37 valyt Exp $ 14 */ 15 16 package gate.email; 17 18 import java.util.*; 19 import java.net.*; 20 import java.io.*; 21 22 import gate.*; 23 import gate.util.*; 24 import gate.gui.*; 25 import gate.email.*; 26 27 import junit.framework.*; 28 import org.w3c.www.mime.*; 29 30 31 /** 32 * Test class for Email facilities 33 */ 34 public class TestEmail extends TestCase 35 { 36 /** Debug flag */ 37 private static final boolean DEBUG = false; 38 39 /** Construction */ 40 public TestEmail(String name) { super(name); } 41 42 /** Fixture set up */ 43 public void setUp() { 44 } // setUp 45 46 /** A test */ 47 public void testUnpackMarkup() throws Exception{ 48 // create the markupElementsMap map 49 Map markupElementsMap = null; 50 gate.Document doc = null; 51 Gate.init(); 52 doc = gate.Factory.newDocument(Gate.getUrl("tests/email/test.eml"), "ISO-8859-1"); 53 54 // get a document format that deals with e-mails 55 gate.DocumentFormat docFormat = gate.DocumentFormat.getDocumentFormat( 56 doc, doc.getSourceUrl() 57 ); 58 assertTrue( "Bad document Format was produced.EmailDocumentFormat was expected", 59 docFormat instanceof gate.corpora.EmailDocumentFormat 60 ); 61 62 docFormat.unpackMarkup (doc,"DocumentContent"); 63 // Verfy if all annotations from the default annotation set are consistent 64 gate.corpora.TestDocument.verifyNodeIdConsistency(doc); 65 66 } // testUnpackMarkup() 67 68 public static void main(String[] args) { 69 try{ 70 Gate.init(); 71 TestEmail testEmail = new TestEmail(""); 72 testEmail.testUnpackMarkup(); 73 74 }catch(Exception e){ 75 e.printStackTrace(); 76 } 77 } 78 79 /** 80 * final test 81 */ 82 public void testEmail(){ 83 EmailDocumentHandler emailDocumentHandler = new EmailDocumentHandler(); 84 emailDocumentHandler.testSelf(); 85 }// testEmail 86 87 /** Test suite routine for the test runner */ 88 public static Test suite() { 89 return new TestSuite(TestEmail.class); 90 } // suite 91 92 } // class TestEmail 93
|
TestEmail |
|