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.SnippetProject; 31 import net.firstpartners.nounit.snippet.Snippets; 32 import org.apache.log4j.Logger; 33 37 public class TestSnippetProject extends TestCase { 38 39 static Logger log = Logger.getLogger(TestSnippetProject.class); 41 42 46 public TestSnippetProject(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(TestSnippetProject.class); 79 } 80 81 82 public void testSnippetProjectsToXml() throws Exception { 83 84 85 Snippets somePackages = TestSnippetData.getSnippetPackages(); 86 87 SnippetProject testProject = new SnippetProject(somePackages); 88 89 String tmpString = testProject.toXml(); 90 91 log.debug(tmpString); 92 93 int oldPlaceHolder=-1; 94 int placeHolder=-1; 95 96 oldPlaceHolder=placeHolder; 98 placeHolder=tmpString.indexOf("<PROJECT>"); 99 assertTrue(placeHolder>oldPlaceHolder); 100 101 oldPlaceHolder=placeHolder; 102 placeHolder=tmpString.indexOf("<PACKAGE location="); 103 assertTrue(placeHolder>oldPlaceHolder); 104 105 oldPlaceHolder=placeHolder; 106 placeHolder=tmpString.indexOf("<CLASS name="); 107 assertTrue(placeHolder>oldPlaceHolder); 108 109 oldPlaceHolder=placeHolder; 110 placeHolder=tmpString.indexOf("access="); 111 assertTrue(placeHolder>oldPlaceHolder); 112 113 oldPlaceHolder=placeHolder; 114 placeHolder=tmpString.indexOf("<EXTENDS name="); 115 assertTrue(placeHolder>oldPlaceHolder); 116 117 oldPlaceHolder=placeHolder; 118 placeHolder=tmpString.indexOf("<METHOD name="); 119 assertTrue(placeHolder>oldPlaceHolder); 120 121 } 122 } 123 124 | Popular Tags |