1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  package ch.qos.logback.core.joran.spi;
15  
16  import org.junit.jupiter.api.Test;
17  
18  import java.lang.annotation.ElementType;
19  import java.lang.annotation.Retention;
20  import java.lang.annotation.RetentionPolicy;
21  import java.lang.annotation.Target;
22  
23  import static org.junit.jupiter.api.Assertions.assertFalse;
24  import static org.junit.jupiter.api.Assertions.assertTrue;
25  
26  public class NoAutoStartUtilTest {
27  
28      @Test
29      public void commonObject() {
30          Object o = new Object();
31          assertTrue(NoAutoStartUtil.notMarkedWithNoAutoStart(o));
32      }
33  
34      @Test
35      public void markedWithNoAutoStart() {
36          DoNotAutoStart o = new DoNotAutoStart();
37          assertFalse(NoAutoStartUtil.notMarkedWithNoAutoStart(o));
38      }
39      
40  
41      
42      
43  
44  
45      @Test
46      public void noAutoStartOnInterface() {
47      	ComponentWithNoAutoStartOnInterface o = new ComponentWithNoAutoStartOnInterface();
48          assertFalse(NoAutoStartUtil.notMarkedWithNoAutoStart(o));
49      }
50  
51      @NoAutoStart
52      public interface NoAutoStartInterface {
53      }
54      
55      private static class ComponentWithNoAutoStartOnInterface implements NoAutoStartInterface {
56      }
57  
58      
59      
60      
61  
62  
63      @Test
64      public void noAutoStartOnAncestor() {
65      	ComponentWithNoAutoStartOnAncestor o = new ComponentWithNoAutoStartOnAncestor();
66          assertFalse(NoAutoStartUtil.notMarkedWithNoAutoStart(o));
67      }
68      
69      private static class ComponentWithNoAutoStartOnAncestor extends DoNotAutoStart {	
70      }
71  
72      
73      
74      
75  
76  
77      @Test
78      public void noAutoStartOnInterfaceImplementedByAncestor() {
79      	ComponentWithAncestorImplementingInterfaceWithNoAutoStart o = new ComponentWithAncestorImplementingInterfaceWithNoAutoStart();
80          assertFalse(NoAutoStartUtil.notMarkedWithNoAutoStart(o));
81      }
82      
83      private static class ComponentWithAncestorImplementingInterfaceWithNoAutoStart extends ComponentWithNoAutoStartOnInterface {	
84      }
85  
86  }