Skip to content

Commit 06059fa

Browse files
Fix CI problem
1 parent 7dd32cc commit 06059fa

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

apm-sniffer/optional-plugins/caffeine-3.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/caffeine/v3/CaffeineInterceptorTest.java

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public class CaffeineInterceptorTest {
4444
@SegmentStoragePoint
4545
private SegmentStorage segmentStorage;
4646

47-
private CaffeineInterceptor caffeineInterceptor;
47+
private CaffeineIterableInterceptor caffeineIterableInterceptor;
48+
private CaffeineMapInterceptor caffeineMapInterceptor;
49+
private CaffeineStringInterceptor caffeineStringInterceptor;
4850
private Object[] operateObjectArguments;
4951

5052
private Exception exception;
@@ -65,7 +67,9 @@ public class CaffeineInterceptorTest {
6567

6668
@Before
6769
public void setUp() throws Exception {
68-
caffeineInterceptor = new CaffeineInterceptor();
70+
caffeineIterableInterceptor = new CaffeineIterableInterceptor();
71+
caffeineMapInterceptor = new CaffeineMapInterceptor();
72+
caffeineStringInterceptor = new CaffeineStringInterceptor();
6973
exception = new Exception();
7074
operateObjectArguments = new Object[] {"dataKey"};
7175
Class<?> cache = Class.forName("com.github.benmanes.caffeine.cache.BoundedLocalCache");
@@ -81,63 +85,64 @@ public void setUp() throws Exception {
8185

8286
@Test
8387
public void testGetAllPresentSuccess() throws Throwable {
84-
caffeineInterceptor.beforeMethod(null, getAllPresentMethod, null, null, null);
85-
caffeineInterceptor.handleMethodException(null, getAllPresentMethod, null, null, exception);
86-
caffeineInterceptor.afterMethod(null, getAllPresentMethod, null, null, null);
88+
caffeineIterableInterceptor.beforeMethod(null, getAllPresentMethod, null, null, null);
89+
caffeineIterableInterceptor.handleMethodException(null, getAllPresentMethod, null, null, exception);
90+
caffeineIterableInterceptor.afterMethod(null, getAllPresentMethod, null, null, null);
8791
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
8892
Assert.assertThat(traceSegments.size(), is(1));
8993
}
9094

9195
@Test
9296
public void testGetIfPresentSuccess() throws Throwable {
93-
caffeineInterceptor.beforeMethod(null, getIfPresentMethod, operateObjectArguments, null, null);
94-
caffeineInterceptor.handleMethodException(null, getIfPresentMethod, operateObjectArguments, null, exception);
95-
caffeineInterceptor.afterMethod(null, getIfPresentMethod, operateObjectArguments, null, null);
97+
caffeineStringInterceptor.beforeMethod(null, getIfPresentMethod, operateObjectArguments, null, null);
98+
caffeineStringInterceptor.handleMethodException(
99+
null, getIfPresentMethod, operateObjectArguments, null, exception);
100+
caffeineStringInterceptor.afterMethod(null, getIfPresentMethod, operateObjectArguments, null, null);
96101
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
97102
Assert.assertThat(traceSegments.size(), is(1));
98103
}
99104

100105
@Test
101106
public void testComputeIfAbsentMethodSuccess() throws Throwable {
102-
caffeineInterceptor.beforeMethod(null, computeIfAbsentMethod, null, null, null);
103-
caffeineInterceptor.handleMethodException(null, computeIfAbsentMethod, null, null, exception);
104-
caffeineInterceptor.afterMethod(null, computeIfAbsentMethod, null, null, null);
107+
caffeineStringInterceptor.beforeMethod(null, computeIfAbsentMethod, null, null, null);
108+
caffeineStringInterceptor.handleMethodException(null, computeIfAbsentMethod, null, null, exception);
109+
caffeineStringInterceptor.afterMethod(null, computeIfAbsentMethod, null, null, null);
105110
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
106111
Assert.assertThat(traceSegments.size(), is(1));
107112
}
108113

109114
@Test
110115
public void testPutMethodSuccess() throws Throwable {
111-
caffeineInterceptor.beforeMethod(null, putMethod, operateObjectArguments, null, null);
112-
caffeineInterceptor.handleMethodException(null, putMethod, operateObjectArguments, null, exception);
113-
caffeineInterceptor.afterMethod(null, putMethod, operateObjectArguments, null, null);
116+
caffeineStringInterceptor.beforeMethod(null, putMethod, operateObjectArguments, null, null);
117+
caffeineStringInterceptor.handleMethodException(null, putMethod, operateObjectArguments, null, exception);
118+
caffeineStringInterceptor.afterMethod(null, putMethod, operateObjectArguments, null, null);
114119
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
115120
Assert.assertThat(traceSegments.size(), is(1));
116121
}
117122

118123
@Test
119124
public void testPutAllMethodSuccess() throws Throwable {
120-
caffeineInterceptor.beforeMethod(null, putAllMethod, null, null, null);
121-
caffeineInterceptor.handleMethodException(null, putAllMethod, null, null, exception);
122-
caffeineInterceptor.afterMethod(null, putAllMethod, null, null, null);
125+
caffeineMapInterceptor.beforeMethod(null, putAllMethod, null, null, null);
126+
caffeineMapInterceptor.handleMethodException(null, putAllMethod, null, null, exception);
127+
caffeineMapInterceptor.afterMethod(null, putAllMethod, null, null, null);
123128
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
124129
Assert.assertThat(traceSegments.size(), is(1));
125130
}
126131

127132
@Test
128133
public void testRemoveMethodSuccess() throws Throwable {
129-
caffeineInterceptor.beforeMethod(null, removeMethod, operateObjectArguments, null, null);
130-
caffeineInterceptor.handleMethodException(null, removeMethod, operateObjectArguments, null, exception);
131-
caffeineInterceptor.afterMethod(null, removeMethod, operateObjectArguments, null, null);
134+
caffeineStringInterceptor.beforeMethod(null, removeMethod, operateObjectArguments, null, null);
135+
caffeineStringInterceptor.handleMethodException(null, removeMethod, operateObjectArguments, null, exception);
136+
caffeineStringInterceptor.afterMethod(null, removeMethod, operateObjectArguments, null, null);
132137
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
133138
Assert.assertThat(traceSegments.size(), is(1));
134139
}
135-
140+
136141
@Test
137142
public void testClearMethodSuccess() throws Throwable {
138-
caffeineInterceptor.beforeMethod(null, cleanMethod, null, null, null);
139-
caffeineInterceptor.handleMethodException(null, cleanMethod, null, null, exception);
140-
caffeineInterceptor.afterMethod(null, cleanMethod, null, null, null);
143+
caffeineStringInterceptor.beforeMethod(null, cleanMethod, null, null, null);
144+
caffeineStringInterceptor.handleMethodException(null, cleanMethod, null, null, exception);
145+
caffeineStringInterceptor.afterMethod(null, cleanMethod, null, null, null);
141146
List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
142147
Assert.assertThat(traceSegments.size(), is(1));
143148
}

0 commit comments

Comments
 (0)