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 35 39 public class TestSnippetCalls extends TestCase { 40 41 static Logger log = Logger.getLogger(TestSnippetCalls.class); 43 44 48 public TestSnippetCalls(String name) { 49 super(name); 50 } 51 52 55 public void setUp(){ 56 57 } 58 59 62 protected void tearDown() { 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(TestSnippetCalls.class); 80 } 81 82 85 public void testSnippetCalledMethodXml() throws Exception { 86 87 IXmlSource thisXmlSource; 89 Iterator loop; 90 String tmpString; 91 StringBuffer results = new StringBuffer (); 92 93 94 Snippets someMethods = TestSnippetData.getSnippetCalledMethods(); 96 97 loop = someMethods.getIterator(); 98 while (loop.hasNext()) { 99 100 thisXmlSource=(IXmlSource)loop.next(); 102 results.append(thisXmlSource.toXml()); 103 results.append("\n"); 104 105 } 106 107 tmpString = results.toString(); 109 110 log.debug(tmpString); 111 int oldPlaceHolder=-1; 112 int placeHolder=-1; 113 114 oldPlaceHolder=placeHolder; 116 placeHolder=tmpString.indexOf("<CALLS"); 117 assertTrue(placeHolder>oldPlaceHolder); 118 119 oldPlaceHolder=placeHolder; 120 placeHolder=tmpString.indexOf("<CLASS"); 121 assertTrue(placeHolder>oldPlaceHolder); 122 123 oldPlaceHolder=placeHolder; 124 placeHolder=tmpString.indexOf("<METHOD"); 125 assertTrue(placeHolder>oldPlaceHolder); 126 127 oldPlaceHolder=placeHolder; 128 placeHolder=tmpString.indexOf("<PARAM"); 129 assertTrue(placeHolder>oldPlaceHolder); 130 } 131 132 133 134 } | Popular Tags |