Skip to content

Commit b2f7ea8

Browse files
committed
fix build - java 8 compatible
1 parent 59912bc commit b2f7ea8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

tests/src/test/java/net/devh/boot/grpc/test/advice/AdviceIsPresentAutoConfigurationTest.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
package net.devh.boot.grpc.test.advice;
1919

2020
import java.lang.reflect.Method;
21+
import java.util.Arrays;
2122
import java.util.Collection;
23+
import java.util.HashMap;
24+
import java.util.HashSet;
2225
import java.util.Map;
2326
import java.util.Set;
2427
import java.util.stream.Collectors;
@@ -71,9 +74,13 @@ class AdviceIsPresentAutoConfigurationTest {
7174
void testAdviceIsPresentWithExceptionMapping() {
7275
log.info("--- Starting tests with advice auto discovery ---");
7376

74-
Map<String, Object> expectedAdviceBeans = Map.of(
75-
"net.devh.boot.grpc.test.config.GrpcAdviceConfig$TestAdviceWithOutMetadata", testAdviceWithOutMetadata,
76-
"net.devh.boot.grpc.test.config.GrpcAdviceConfig$TestAdviceWithMetadata", testAdviceWithMetadata);
77+
Map<String, Object> expectedAdviceBeans = new HashMap<>();
78+
expectedAdviceBeans.put(
79+
"net.devh.boot.grpc.test.config.GrpcAdviceConfig$TestAdviceWithOutMetadata",
80+
testAdviceWithOutMetadata);
81+
expectedAdviceBeans.put(
82+
"net.devh.boot.grpc.test.config.GrpcAdviceConfig$TestAdviceWithMetadata",
83+
testAdviceWithMetadata);
7784
Set<Method> expectedAdviceMethods = expectedMethods();
7885

7986
Map<String, Object> actualAdviceBeans = grpcAdviceDiscoverer.getAnnotatedBeans();
@@ -92,8 +99,11 @@ void testAdviceIsPresentWithExceptionMapping() {
9299
// ###################
93100

94101
private Set<Method> expectedMethods() {
95-
Set<Method> methodsWithMetadata = Set.of(testAdviceWithMetadata.getClass().getDeclaredMethods());
96-
Set<Method> methodsWithOutMetadata = Set.of(testAdviceWithOutMetadata.getClass().getDeclaredMethods());
102+
new HashSet<>();
103+
Set<Method> methodsWithMetadata =
104+
Arrays.stream(testAdviceWithMetadata.getClass().getDeclaredMethods()).collect(Collectors.toSet());
105+
Set<Method> methodsWithOutMetadata =
106+
Arrays.stream(testAdviceWithOutMetadata.getClass().getDeclaredMethods()).collect(Collectors.toSet());
97107

98108
return Stream.of(methodsWithMetadata, methodsWithOutMetadata)
99109
.flatMap(Collection::stream)

0 commit comments

Comments
 (0)