forked from junit-team/junit4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Here's what categories would look like
- Loading branch information
David Saff
committed
Jul 31, 2009
1 parent
a8629da
commit 7e74bfd
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import static org.junit.Assert.fail; | ||
import org.junit.rules.MethodRule; | ||
import org.junit.rules.Timeout; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Suite; | ||
import org.junit.runners.Suite.SuiteClasses; | ||
|
||
|
||
public class CategoryTest { | ||
public static class A { | ||
public void a() { | ||
// pass | ||
} | ||
|
||
@Category(SlowTests.class) | ||
public void b() { | ||
fail(); | ||
} | ||
} | ||
|
||
@Category(SlowTests.class) | ||
public static class B { | ||
public void c() { | ||
|
||
} | ||
} | ||
|
||
public static class C { | ||
public void d() { | ||
|
||
} | ||
} | ||
|
||
@RunWith(Suite.class) | ||
@SuiteClasses({A.class, B.class, C.class}) | ||
public static class AbcTest { | ||
enum JUnitCategories { | ||
INTEGRATION, UNIT, GOOD, BAD; | ||
} | ||
|
||
enum GoogleCategories extends JUnitCategories { | ||
SMALL, MEDIUM, LARGE, ENORMOUS; | ||
} | ||
|
||
@SuiteRule public Filter filter = new CategoryFilter(Category.class, SLOW); | ||
@SuiteRule public Filter decimator = new RandomFilter(0.1); | ||
|
||
@SuiteRule public SuiteRule globalTimeout = GlobalTimeout.createTimeoutOnEachMethod(1000); | ||
|
||
public static MethodRule GOOGLE_DEFAULT_TIMEOUT = new Timeout(1000); | ||
|
||
SuiteRule | ||
@SuiteRule public MethodRule timeout = new Timeout(1000); | ||
|
||
@SuiteRule public MethodRuleDistributor timeoutDistributer = | ||
new MethodRuleDistributor(new Timeout(1000)); | ||
} | ||
} |