1 package org.apache.maven.surefire.junitcore;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.lang.annotation.Annotation;
23 import java.lang.reflect.Method;
24 import org.apache.maven.surefire.common.junit4.JUnit4Reflector;
25 import org.apache.maven.surefire.util.ReflectionUtils;
26
27 import org.junit.Assert;
28 import org.junit.Ignore;
29 import org.junit.Test;
30 import org.junit.runner.Description;
31
32
33
34
35
36
37 public class JUnit4Reflector481Test
38 {
39 private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
40
41 @Test
42 public void testGetAnnotatedIgnore()
43 {
44 JUnit4Reflector reflector = new JUnit4Reflector();
45 final Method testSomething2 =
46 ReflectionUtils.getMethod( IgnoreWithDescription.class, "testSomething2", EMPTY_CLASS_ARRAY );
47 final Annotation[] annotations = testSomething2.getAnnotations();
48 Description desc =
49 Description.createTestDescription( IgnoreWithDescription.class, "testSomething2", annotations );
50 Ignore annotatedIgnore = reflector.getAnnotatedIgnore( desc );
51 Assert.assertEquals( reason, annotatedIgnore.value() );
52 }
53
54 private static final String reason = "Ignorance is bliss";
55
56 public static class IgnoreWithDescription
57 {
58
59 @Test
60 @Ignore( reason )
61 public void testSomething2()
62 {
63 }
64 }
65
66
67 }