1 package net.firstpartners.nounit.snippet.test; 2 3 26 import java.util.Iterator ; 27 28 import junit.framework.Test; 29 import junit.framework.TestCase; 30 import junit.framework.TestSuite; 31 import net.firstpartners.nounit.snippet.Snippets; 32 import net.firstpartners.nounit.snippet.xml.IXmlSource; 33 import org.apache.log4j.Logger; 34 38 public class TestSnippetClass extends TestCase { 39 40 static Logger log = Logger.getLogger(TestSnippetClass.class); 42 43 47 public TestSnippetClass(String name) { 48 super(name); 49 } 50 51 54 public void setUp(){ 55 56 } 57 58 61 protected void tearDown() 62 { 63 64 } 65 66 70 public static void main(String [] args) { 71 junit.textui.TestRunner.run (suite()); 72 } 73 74 78 public static Test suite() { 79 return new TestSuite(TestSnippetClass.class); 80 } 81 82 public void testSnippetMethodXml() throws Exception { 83 84 IXmlSource thisXmlSource; 86 Iterator loop; 87 String tmpString; 88 StringBuffer results = new StringBuffer (); 89 90 91 Snippets someMethods = TestSnippetData.getSnippetClasses(); 93 94 loop = someMethods.getIterator(); 95 while (loop.hasNext()) { 96 97 thisXmlSource=(IXmlSource)loop.next(); 99 results.append(thisXmlSource.toXml()); 100 results.append("\n"); 101 102 } 103 104 tmpString = results.toString(); 106 107 108 log.debug(tmpString); 109 110 int oldPlaceHolder=-1; 111 int placeHolder=-1; 112 113 oldPlaceHolder=placeHolder; 115 placeHolder=tmpString.indexOf("<CLASS name="); 116 assertTrue(placeHolder>oldPlaceHolder); 117 118 oldPlaceHolder=placeHolder; 119 placeHolder=tmpString.indexOf("access="); 120 assertTrue(placeHolder>oldPlaceHolder); 121 122 oldPlaceHolder=placeHolder; 123 placeHolder=tmpString.indexOf("<EXTENDS name="); 124 assertTrue(placeHolder>oldPlaceHolder); 125 126 oldPlaceHolder=placeHolder; 127 placeHolder=tmpString.indexOf("<METHOD name="); 128 assertTrue(placeHolder>oldPlaceHolder); 129 } 130 } 131 | Popular Tags |