3
3
import static org .hamcrest .CoreMatchers .containsString ;
4
4
import static org .hamcrest .CoreMatchers .is ;
5
5
import static org .hamcrest .CoreMatchers .notNullValue ;
6
+ import static org .hamcrest .CoreMatchers .nullValue ;
6
7
import static org .junit .Assert .assertThat ;
7
8
import static org .junit .Assume .assumeThat ;
8
-
9
9
import org .hamcrest .Matcher ;
10
10
import org .hamcrest .StringDescription ;
11
11
import org .junit .experimental .theories .DataPoint ;
16
16
@ RunWith (Theories .class )
17
17
public class AssumptionViolatedExceptionTest {
18
18
@ DataPoint
19
- public static Object TWO = 2 ;
19
+ public static Integer TWO = 2 ;
20
20
21
21
@ DataPoint
22
- public static Matcher <? > IS_THREE = is (3 );
22
+ public static Matcher <Integer > IS_THREE = is (3 );
23
23
24
24
@ DataPoint
25
- public static Matcher <? > NULL = null ;
25
+ public static Matcher <Integer > NULL = null ;
26
26
27
27
@ Theory
28
- public void toStringReportsMatcher (Object actual , Matcher <? > matcher ) {
28
+ public void toStringReportsMatcher (Integer actual , Matcher <Integer > matcher ) {
29
29
assumeThat (matcher , notNullValue ());
30
30
assertThat (new AssumptionViolatedException (actual , matcher ).toString (),
31
31
containsString (matcher .toString ()));
32
32
}
33
33
34
34
@ Theory
35
- public void toStringReportsValue (Object actual , Matcher <? > matcher ) {
35
+ public void toStringReportsValue (Integer actual , Matcher <Integer > matcher ) {
36
36
assertThat (new AssumptionViolatedException (actual , matcher ).toString (),
37
37
containsString (String .valueOf (actual )));
38
38
}
@@ -58,26 +58,32 @@ public void canInitCauseWithInstanceCreatedWithString() {
58
58
}
59
59
60
60
@ Test
61
+ @ SuppressWarnings ("deprecation" )
61
62
public void canSetCauseWithInstanceCreatedWithObjectAndMatcher () {
62
63
Throwable testObject = new Exception ();
63
- AssumptionViolatedException e = new AssumptionViolatedException (testObject , containsString ("test matcher" ));
64
+ org .junit .internal .AssumptionViolatedException e
65
+ = new org .junit .internal .AssumptionViolatedException (
66
+ testObject , containsString ("test matcher" ));
64
67
assertThat (e .getCause (), is (testObject ));
65
68
}
66
69
67
70
@ Test
71
+ @ SuppressWarnings ("deprecation" )
68
72
public void canSetCauseWithInstanceCreatedWithAssumptionObjectAndMatcher () {
69
73
Throwable testObject = new Exception ();
70
- AssumptionViolatedException e = new AssumptionViolatedException (
71
- "sample assumption" , testObject , containsString ( "test matcher" ));
72
-
74
+ org . junit . internal . AssumptionViolatedException e
75
+ = new org . junit . internal . AssumptionViolatedException (
76
+ "sample assumption" , testObject , containsString ( "test matcher" ));
73
77
assertThat (e .getCause (), is (testObject ));
74
78
}
75
79
76
80
@ Test
81
+ @ SuppressWarnings ("deprecation" )
77
82
public void canSetCauseWithInstanceCreatedWithMainConstructor () {
78
83
Throwable testObject = new Exception ();
79
- AssumptionViolatedException e = new AssumptionViolatedException (
80
- "sample assumption" , false , testObject , containsString ("test matcher" ));
84
+ org .junit .internal .AssumptionViolatedException e
85
+ = new org .junit .internal .AssumptionViolatedException (
86
+ "sample assumption" , false , testObject , containsString ("test matcher" ));
81
87
assertThat (e .getCause (), is (testObject ));
82
88
}
83
89
0 commit comments