|
6 | 6 | package io.opentelemetry.javaagent.tooling.muzzle; |
7 | 7 |
|
8 | 8 | import static org.assertj.core.api.Assertions.assertThat; |
9 | | -import static org.assertj.core.api.Assertions.atIndex; |
10 | 9 |
|
11 | 10 | import io.opentelemetry.javaagent.tooling.muzzle.references.ClassRef; |
12 | 11 | import io.opentelemetry.javaagent.tooling.muzzle.references.Flag; |
@@ -74,105 +73,81 @@ void shouldWrapHelperTypes() { |
74 | 73 | assertThat(helperWrapper.isAbstract()).isFalse(); |
75 | 74 |
|
76 | 75 | assertThat(helperWrapper.getMethods()) |
77 | | - .hasSize(1) |
78 | | - .satisfies( |
| 76 | + .satisfiesExactly( |
79 | 77 | method -> { |
80 | 78 | assertThat(method.isAbstract()).isFalse(); |
81 | 79 | assertThat(method.getName()).isEqualTo("bar"); |
82 | 80 | assertThat(method.getDescriptor()).isEqualTo("()V"); |
83 | | - }, |
84 | | - atIndex(0)); |
| 81 | + }); |
85 | 82 |
|
86 | 83 | assertThat(helperWrapper.getFields()) |
87 | | - .hasSize(1) |
88 | | - .satisfies( |
| 84 | + .satisfiesExactly( |
89 | 85 | field -> { |
90 | 86 | assertThat(field.getName()).isEqualTo("declaredField"); |
91 | 87 | assertThat(field.getDescriptor()).isEqualTo("Ljava/lang/Object;"); |
92 | | - }, |
93 | | - atIndex(0)); |
| 88 | + }); |
94 | 89 |
|
95 | 90 | assertThat(helperWrapper.hasSuperTypes()).isTrue(); |
96 | 91 | assertThat(helperWrapper.getSuperTypes()) |
97 | | - .hasSize(2) |
98 | | - .satisfies( |
| 92 | + .satisfiesExactly( |
99 | 93 | baseHelper -> { |
100 | 94 | assertThat(baseHelper.isAbstract()).isTrue(); |
101 | 95 | assertThat(baseHelper.getMethods()) |
102 | | - .hasSize(2) |
103 | | - .satisfies( |
| 96 | + .satisfiesExactly( |
104 | 97 | method -> { |
105 | 98 | assertThat(method.isAbstract()).isFalse(); |
106 | 99 | assertThat(method.getName()).isEqualTo("foo"); |
107 | 100 | assertThat(method.getDescriptor()).isEqualTo("()V"); |
108 | 101 | }, |
109 | | - atIndex(0)) |
110 | | - .satisfies( |
111 | 102 | method -> { |
112 | 103 | assertThat(method.isAbstract()).isTrue(); |
113 | 104 | assertThat(method.getName()).isEqualTo("abstract"); |
114 | 105 | assertThat(method.getDescriptor()).isEqualTo("()I"); |
115 | | - }, |
116 | | - atIndex(1)); |
| 106 | + }); |
117 | 107 |
|
118 | 108 | assertThat(baseHelper.hasSuperTypes()).isTrue(); |
119 | 109 | assertThat(baseHelper.getSuperTypes()) |
120 | | - .hasSize(1) |
121 | | - .satisfies( |
122 | | - abstractClasspathType -> { |
123 | | - assertThat(abstractClasspathType.isAbstract()).isTrue(); |
124 | | - assertThat(abstractClasspathType.getMethods()).isEmpty(); |
125 | | - |
126 | | - assertThat(abstractClasspathType.getFields()) |
127 | | - .hasSize(1) |
128 | | - .satisfies( |
| 110 | + .satisfiesExactly( |
| 111 | + helperReferenceWrapper -> { |
| 112 | + assertThat(helperReferenceWrapper.isAbstract()).isTrue(); |
| 113 | + assertThat(helperReferenceWrapper.getMethods()).isEmpty(); |
| 114 | + |
| 115 | + assertThat(helperReferenceWrapper.getFields()) |
| 116 | + .satisfiesExactly( |
129 | 117 | field -> { |
130 | 118 | assertThat(field.getName()).isEqualTo("field"); |
131 | 119 | assertThat(field.getDescriptor()).isEqualTo("Ljava/lang/Object;"); |
132 | | - }, |
133 | | - atIndex(0)); |
| 120 | + }); |
134 | 121 |
|
135 | | - assertThat(abstractClasspathType.hasSuperTypes()).isTrue(); |
136 | | - assertThat(abstractClasspathType.getSuperTypes()) |
137 | | - .hasSize(2) |
138 | | - .satisfies( |
| 122 | + assertThat(helperReferenceWrapper.hasSuperTypes()).isTrue(); |
| 123 | + assertThat(helperReferenceWrapper.getSuperTypes()) |
| 124 | + .satisfiesExactly( |
139 | 125 | wrapper -> assertThat(wrapper.hasSuperTypes()).isFalse(), |
140 | | - atIndex(0)) |
141 | | - .satisfies( |
142 | 126 | wrapper -> { |
143 | 127 | assertThat(wrapper.isAbstract()).isTrue(); |
144 | 128 | assertThat(wrapper.getMethods()) |
145 | | - .hasSize(1) |
146 | | - .satisfies( |
| 129 | + .satisfiesExactly( |
147 | 130 | method -> { |
148 | 131 | assertThat(method.isAbstract()).isTrue(); |
149 | 132 | assertThat(method.getName()).isEqualTo("foo"); |
150 | 133 | assertThat(method.getDescriptor()).isEqualTo("()V"); |
151 | | - }, |
152 | | - atIndex(0)); |
| 134 | + }); |
153 | 135 | assertThat(wrapper.hasSuperTypes()).isFalse(); |
154 | 136 | assertThat(wrapper.getSuperTypes()).isEmpty(); |
155 | | - }, |
156 | | - atIndex(1)); |
157 | | - }, |
158 | | - atIndex(0)); |
| 137 | + }); |
| 138 | + }); |
159 | 139 | }, |
160 | | - atIndex(0)) |
161 | | - .satisfies( |
162 | | - interface2 -> { |
163 | | - assertThat(interface2.isAbstract()).isTrue(); |
164 | | - assertThat(interface2.getMethods()) |
165 | | - .hasSize(1) |
166 | | - .satisfies( |
| 140 | + wrapper -> { |
| 141 | + assertThat(wrapper.isAbstract()).isTrue(); |
| 142 | + assertThat(wrapper.getMethods()) |
| 143 | + .satisfiesExactly( |
167 | 144 | method -> { |
168 | 145 | assertThat(method.isAbstract()).isTrue(); |
169 | 146 | assertThat(method.getName()).isEqualTo("bar"); |
170 | 147 | assertThat(method.getDescriptor()).isEqualTo("()V"); |
171 | | - }, |
172 | | - atIndex(0)); |
173 | | - assertThat(interface2.hasSuperTypes()).isFalse(); |
174 | | - assertThat(interface2.getSuperTypes()).isEmpty(); |
175 | | - }, |
176 | | - atIndex(1)); |
| 148 | + }); |
| 149 | + assertThat(wrapper.hasSuperTypes()).isFalse(); |
| 150 | + assertThat(wrapper.getSuperTypes()).isEmpty(); |
| 151 | + }); |
177 | 152 | } |
178 | 153 | } |
0 commit comments