1 package net.firstpartners.nounit.snippet.test; 2 3 26 27 import junit.framework.Test; 28 import junit.framework.TestCase; 29 import junit.framework.TestSuite; 30 import net.firstpartners.nounit.snippet.SnippetPackage; 31 import net.firstpartners.nounit.snippet.Snippets; 32 import org.apache.log4j.Logger; 33 37 public class TestSnippetPackage extends TestCase { 38 39 static Logger log = Logger.getLogger(TestSnippetPackage.class); 41 42 46 public TestSnippetPackage(String name) { 47 super(name); 48 } 49 50 53 public void setUp(){ 54 55 } 56 57 60 protected void tearDown() 61 { 62 63 } 64 65 69 public static void main(String [] args) { 70 junit.textui.TestRunner.run (suite()); 71 } 72 73 77 public static Test suite() { 78 return new TestSuite(TestSnippetPackage.class); 79 } 80 81 public void testSnippetPackages() throws Exception { 82 83 84 Snippets someClasses = TestSnippetData.getSnippetClasses(); 85 86 SnippetPackage testPackage = new SnippetPackage("testName",someClasses); 87 88 String tmpString = testPackage.toString(); 89 90 91 } 92 93 public void testSnippetPackagesToXml() throws Exception { 94 95 96 Snippets someClasses = TestSnippetData.getSnippetClasses(); 97 98 SnippetPackage testPackage = new SnippetPackage("testPackageName",someClasses); 99 100 String tmpString = testPackage.toXml(); 101 102 log.debug(tmpString); 103 104 int oldPlaceHolder=-1; 105 int placeHolder=-1; 106 107 oldPlaceHolder=placeHolder; 109 placeHolder=tmpString.indexOf("<PACKAGE location="); 110 assertTrue(placeHolder>oldPlaceHolder); 111 112 oldPlaceHolder=placeHolder; 113 placeHolder=tmpString.indexOf("<CLASS name="); 114 assertTrue(placeHolder>oldPlaceHolder); 115 116 oldPlaceHolder=placeHolder; 117 placeHolder=tmpString.indexOf("access="); 118 assertTrue(placeHolder>oldPlaceHolder); 119 120 oldPlaceHolder=placeHolder; 121 placeHolder=tmpString.indexOf("<EXTENDS name="); 122 assertTrue(placeHolder>oldPlaceHolder); 123 124 oldPlaceHolder=placeHolder; 125 placeHolder=tmpString.indexOf("<METHOD name="); 126 assertTrue(placeHolder>oldPlaceHolder); 127 128 } 129 } 130 131 | Popular Tags |