KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > remoting > ChannelTestSuite


1 package hudson.remoting;
2
3 import junit.framework.Test;
4 import junit.framework.TestSuite;
5
6 import java.util.Enumeration JavaDoc;
7
8 /**
9  * {@link TestSuite} that configures {@link RmiTestBase} as they are added.
10  *
11  * <p>
12  * This allows the same test method to be run twice with different
13  * {@link ChannelRunner}.
14  *
15  * @author Kohsuke Kawaguchi
16  */

17 public class ChannelTestSuite extends TestSuite {
18     public ChannelTestSuite(Class JavaDoc testClass, Class JavaDoc<? extends ChannelRunner> channelRunner) {
19         super(testClass);
20
21         // I can't do this in addTest because it happens in the above constructor!
22

23         Enumeration JavaDoc en = tests();
24         while (en.hasMoreElements()) {
25             Test test = (Test) en.nextElement();
26
27             if(test instanceof RmiTestBase && channelRunner!=null) {
28                 ((RmiTestBase)test).setChannelRunner(channelRunner);
29             }
30         }
31     }
32 }
33
Popular Tags