1 package org.apache.maven.surefire.its;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.VerificationException;
23 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
24 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
25 import org.junit.Test;
26
27 import java.io.IOException;
28
29
30
31
32
33
34
35 public class JUnit48TestCategoriesIT
36 extends SurefireJUnit4IntegrationTestCase
37 {
38 @Test
39 public void testCategoriesAB()
40 throws Exception
41 {
42 runAB( unpacked() );
43 }
44
45
46 @Test
47 public void testCategoriesABForkAlways()
48 throws Exception
49 {
50 runAB( unpacked() );
51 }
52
53 @Test
54 public void testCategoriesAC()
55 throws Exception
56 {
57 runAC( unpacked() );
58 }
59
60 private void runAB( SurefireLauncher unpacked )
61 throws VerificationException
62 {
63 unpacked.executeTest().verifyErrorFreeLog().assertTestSuiteResults( 3, 0, 0, 0 ).verifyTextInLog(
64 "catA: 1" ).verifyTextInLog( "catB: 1" ).verifyTextInLog( "catC: 0" ).verifyTextInLog( "catNone: 0" );
65 }
66
67 @Test
68 public void testCategoriesACForkAlways()
69 throws Exception
70 {
71 runAC( unpacked().forkAlways() );
72 }
73
74
75 private void runAC( SurefireLauncher surefireLauncher )
76 throws Exception
77 {
78 surefireLauncher.groups(
79 "junit4.CategoryA,junit4.CategoryC" ).executeTest().verifyErrorFreeLog().assertTestSuiteResults( 6, 0, 0,
80 0 ).verifyTextInLog(
81 "catA: 1" ).verifyTextInLog( "catB: 0" ).verifyTextInLog( "catC: 1" ).verifyTextInLog(
82 "catNone: 0" ).verifyTextInLog( "mA: 1" ).verifyTextInLog(
83 "mB: 1" )
84 .verifyTextInLog( "mC: 1" ).verifyTextInLog( "CatNone: 1" );
85 }
86
87 private SurefireLauncher unpacked()
88 throws VerificationException, IOException
89 {
90 return unpack( "/junit48-categories" );
91 }
92
93 }