View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.juneau.commons.reflect;
18  
19  import static org.junit.jupiter.api.Assertions.*;
20  
21  import org.apache.juneau.*;
22  import org.junit.jupiter.api.*;
23  
24  class AnnotationTraversal_Test extends TestBase {
25  
26  	//====================================================================================================
27  	// getOrder()
28  	//====================================================================================================
29  	@Test
30  	void a001_getOrder() {
31  		// Test all enum values and their order values
32  		assertEquals(10, AnnotationTraversal.SELF.getOrder());
33  		assertEquals(20, AnnotationTraversal.PARENTS.getOrder());
34  		assertEquals(20, AnnotationTraversal.MATCHING_METHODS.getOrder());
35  		assertEquals(20, AnnotationTraversal.MATCHING_PARAMETERS.getOrder());
36  		assertEquals(30, AnnotationTraversal.RETURN_TYPE.getOrder());
37  		assertEquals(30, AnnotationTraversal.PARAMETER_TYPE.getOrder());
38  		assertEquals(35, AnnotationTraversal.DECLARING_CLASS.getOrder());
39  		assertEquals(40, AnnotationTraversal.PACKAGE.getOrder());
40  		assertEquals(999, AnnotationTraversal.REVERSE.getOrder());
41  		
42  		// Verify order values are as expected (lower values = higher precedence)
43  		assertTrue(AnnotationTraversal.SELF.getOrder() < AnnotationTraversal.PARENTS.getOrder());
44  		assertTrue(AnnotationTraversal.PARENTS.getOrder() < AnnotationTraversal.RETURN_TYPE.getOrder());
45  		assertTrue(AnnotationTraversal.RETURN_TYPE.getOrder() < AnnotationTraversal.DECLARING_CLASS.getOrder());
46  		assertTrue(AnnotationTraversal.DECLARING_CLASS.getOrder() < AnnotationTraversal.PACKAGE.getOrder());
47  		assertTrue(AnnotationTraversal.PACKAGE.getOrder() < AnnotationTraversal.REVERSE.getOrder());
48  	}
49  }
50