Skip to content

Commit 132d79b

Browse files
committed
fix ut
1 parent d87ca4c commit 132d79b

File tree

1 file changed

+13
-7
lines changed
  • instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kafkastreams

1 file changed

+13
-7
lines changed

instrumentation/kafka/kafka-streams-0.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kafkastreams/KafkaStreamReflectionUtil.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,36 @@ private KafkaStreamReflectionUtil() {}
2323

2424
@SuppressWarnings("ClassNewInstance")
2525
static Object createBuilder()
26-
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
26+
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
2727
try {
2828
// Different class names for test and latestDepTest.
2929
return Class.forName("org.apache.kafka.streams.kstream.KStreamBuilder").newInstance();
30-
} catch (ClassNotFoundException | NoClassDefFoundError e) {
30+
} catch (ClassNotFoundException
31+
| NoClassDefFoundError
32+
| InstantiationException
33+
| IllegalAccessException e) {
3134
return Class.forName("org.apache.kafka.streams.StreamsBuilder").newInstance();
3235
}
3336
}
3437

3538
@SuppressWarnings("unchecked")
3639
static KStream<Integer, String> stream(Object builder, String topic)
37-
throws IllegalAccessException,
38-
InvocationTargetException,
40+
throws ClassNotFoundException,
3941
NoSuchMethodException,
40-
ClassNotFoundException {
42+
InvocationTargetException,
43+
IllegalAccessException {
4144
// Different api for test and latestDepTest.
4245
try {
4346
// equivalent to:
4447
// ((org.apache.kafka.streams.kstream.KStreamBuilder)builder).stream(STREAM_PENDING);
4548
return (KStream<Integer, String>)
4649
Class.forName("org.apache.kafka.streams.kstream.KStreamBuilder")
47-
.getMethod("stream", String.class)
50+
.getMethod("stream", String[].class)
4851
.invoke(builder, topic);
49-
} catch (ClassNotFoundException e) {
52+
} catch (ClassNotFoundException
53+
| NoSuchMethodException
54+
| IllegalAccessException
55+
| InvocationTargetException e) {
5056
// equivalent to:
5157
// ((org.apache.kafka.streams.StreamsBuilder)builder).stream(STREAM_PENDING);
5258
return (KStream<Integer, String>)

0 commit comments

Comments
 (0)