1 19 20 25 26 package org.netbeans.test.gui.javadoc; 27 28 import java.io.File ; 29 import java.io.FileReader ; 30 import java.io.BufferedReader ; 31 import java.io.FileNotFoundException ; 32 import java.io.IOException ; 33 34 import junit.framework.AssertionFailedError; 35 36 import org.netbeans.jellytools.JellyTestCase; 37 import org.netbeans.junit.AssertionFailedErrorException; 38 39 43 public class JavadocTestCase extends JellyTestCase { 44 45 46 public JavadocTestCase(String testName) { 47 super(testName); 48 super.initEnvironment(); 49 } 50 51 public static void assertTemplateInFile(File file, String templ, String msg) { 52 53 BufferedReader br = null; 54 boolean contains = false; 55 56 try { 57 br = new BufferedReader (new FileReader (file)); 58 } catch (FileNotFoundException fnfe) { 59 throw new AssertionFailedErrorException("Problems when reading file!", fnfe); 60 } 61 62 try { 63 String line = br.readLine(); 64 while (line != null) { 65 if (line.indexOf(templ) != -1) { 66 contains = true; 67 } 68 line = br.readLine(); 69 } 70 } catch (IOException ioe) { 71 throw new AssertionFailedErrorException("Problems when reading file!", ioe); 72 } 73 if (!contains) { 74 throw new AssertionFailedError(msg); 75 } 76 77 } 78 79 } 80 | Popular Tags |