1 package org.lcsim.util.test;
2
3 import java.io.InputStream;
4
5 import junit.extensions.TestSetup;
6 import junit.framework.Test;
7
8 import org.lcsim.geometry.Detector;
9 import org.lcsim.geometry.GeometryReader;
10
11
12
13
14
15 public class OneTimeDetectorSetup extends TestSetup
16 {
17 static Detector detector = null;
18 String detLoc = null;
19
20 public OneTimeDetectorSetup(Test test, String detLoc)
21 {
22 super(test);
23 this.detLoc = detLoc;
24 }
25
26 public void setUp()
27 {
28
29 try
30 {
31 InputStream in = GeometryReader.class.getResourceAsStream(detLoc);
32 GeometryReader reader = new GeometryReader();
33 detector = reader.read(in);
34 }
35 catch (Exception e)
36 {
37 throw new RuntimeException("GeometryReaderTest.setUp() - GeometryReader failed.", e);
38 }
39 }
40
41 public static Detector getDetector()
42 {
43 return detector;
44 }
45 }