View Javadoc
1   /*
2    * MIT License
3    * Copyright (c) 2006-2025 JMockit developers
4    * See LICENSE file for full license text.
5    */
6   package mockit.asm.constantPool;
7   
8   import static org.junit.jupiter.api.Assertions.assertEquals;
9   import static org.junit.jupiter.api.Assertions.assertFalse;
10  import static org.junit.jupiter.api.Assertions.assertTrue;
11  
12  import org.junit.jupiter.api.Test;
13  
14  final class BootstrapMethodItemTest {
15  
16      @Test
17      void constructorSetsPositionAndIndex() {
18          BootstrapMethodItem item = new BootstrapMethodItem(5, 100, 42);
19          assertEquals(5, item.index);
20          assertEquals(100, item.position);
21      }
22  
23      @Test
24      void isEqualToWithSamePosition() {
25          BootstrapMethodItem item1 = new BootstrapMethodItem(1, 100, 42);
26          BootstrapMethodItem item2 = new BootstrapMethodItem(2, 100, 42);
27          assertTrue(item1.isEqualTo(item2));
28      }
29  
30      @Test
31      void isEqualToWithDifferentPosition() {
32          BootstrapMethodItem item1 = new BootstrapMethodItem(1, 100, 42);
33          BootstrapMethodItem item2 = new BootstrapMethodItem(2, 200, 42);
34          assertFalse(item1.isEqualTo(item2));
35      }
36  }