Commit in GeomConverter/test/org/lcsim/geometry/compact on RefactorBranch
CompactReaderTest.java+46-201.3.2.1 -> 1.3.2.2
add region and limitset sanity checks to test of CompactReader

GeomConverter/test/org/lcsim/geometry/compact
CompactReaderTest.java 1.3.2.1 -> 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- CompactReaderTest.java	31 Oct 2005 19:02:58 -0000	1.3.2.1
+++ CompactReaderTest.java	1 Dec 2005 03:03:31 -0000	1.3.2.2
@@ -12,24 +12,50 @@
  */
 public class CompactReaderTest extends TestCase
 {
-   public CompactReaderTest(String testName)
-   {
-      super(testName);
-   }
-   
-   public static Test suite()
-   {
-      return new TestSuite(CompactReaderTest.class);
-   }
-   
-   /**
-    * Test of read method, of class org.lcsim.geometry.compact.CompactReader.
-    */
-   public void testRead() throws IOException, JDOMException, ElementCreationException
-   {
-      InputStream in = CompactReaderTest.class.getResourceAsStream("sdjan03_compact.xml");
-      CompactReader reader = new CompactReader();
-      Detector det = reader.read(in);
-      assertEquals(11,det.getSubdetectors().size());
-   }
+    Detector det = null;
+    
+    public CompactReaderTest(String testName)
+    {
+        super(testName);
+    }
+    
+    public static Test suite()
+    {
+        return new TestSuite(CompactReaderTest.class);
+    }
+    
+    /* setup the in-memory rep of compact XML description from test file */
+    protected void setUp() throws Exception
+    {
+        InputStream in = CompactReaderTest.class.getResourceAsStream("sdjan03_compact.xml");
+        CompactReader reader = new CompactReader();
+        det = reader.read(in);
+    }
+    
+    /* subdetector count */
+    public void testDetectorCount()
+    {
+        assertEquals(11,det.getSubdetectors().size());
+    }
+    
+    /* limits test */
+    public void testLimits()
+    {
+        LimitSet limitset = det.getLimitSet("MyLimits");        
+        assert(limitset != null);               
+        
+        Limit limit = limitset.getLimit("step_length_max");
+        assert(limit != null);
+        
+        assertEquals(limit.getValue(), 1.0);
+        assertEquals(limit.getUnit(), "mm");
+        assertEquals(limit.getParticles(), "*");
+    }
+    
+    /* regions test */
+    public void testRegions()
+    {
+        Region region = det.getRegion("MyRegion");
+        assert(region != null);
+    }
 }
\ No newline at end of file
CVSspam 0.2.8