KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > test > TCTestCaseDisableSingleTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.test;
5
6 /**
7  * Test that single test cases can be disabled
8  */

9 public class TCTestCaseDisableSingleTest extends TCTestCase {
10   static final int numTests = 3;
11   static int count = 0;
12   static boolean testSkipped = false;
13
14   public TCTestCaseDisableSingleTest() {
15     disableTestUntil("testSkip1", "3000-01-01");
16     disableTestUntil("testSkip2", "3000-01-01");
17   }
18
19   protected void tearDown() throws Exception JavaDoc {
20     super.tearDown();
21
22     assertTrue("count is " + count, (count > 0) && (count <= numTests));
23
24     if (count == numTests) {
25       if (!testSkipped) {
26         fail("Test not skipped");
27       }
28     }
29   }
30
31   public void testNotSkipped() {
32     testSkipped = true;
33     return;
34   }
35
36   public void testSkip1() {
37     throw new RuntimeException JavaDoc("should have been skipped");
38   }
39
40   public void testSkip2() {
41     throw new RuntimeException JavaDoc("should have been skipped");
42   }
43
44   public void runBare() throws Throwable JavaDoc {
45     count++;
46     super.runBare();
47   }
48 }
Popular Tags