|
1 | 1 | /* |
2 | | - * Copyright 2012-2024 the original author or authors. |
| 2 | + * Copyright 2012-2025 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
48 | 48 | import org.springframework.context.annotation.Configuration; |
49 | 49 | import org.springframework.core.task.AsyncTaskExecutor; |
50 | 50 | import org.springframework.core.task.SimpleAsyncTaskExecutor; |
51 | | -import org.springframework.core.task.TaskExecutor; |
52 | 51 | import org.springframework.messaging.converter.CompositeMessageConverter; |
53 | 52 | import org.springframework.messaging.converter.MessageConverter; |
54 | 53 | import org.springframework.messaging.converter.SimpleMessageConverter; |
|
61 | 60 | import org.springframework.messaging.simp.stomp.StompSession; |
62 | 61 | import org.springframework.messaging.simp.stomp.StompSessionHandler; |
63 | 62 | import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter; |
64 | | -import org.springframework.security.util.FieldUtils; |
65 | 63 | import org.springframework.stereotype.Controller; |
66 | 64 | import org.springframework.web.client.RestTemplate; |
67 | 65 | import org.springframework.web.socket.client.standard.StandardWebSocketClient; |
@@ -139,27 +137,25 @@ void customizedConverterTypesMatchDefaultConverterTypes() { |
139 | 137 | } |
140 | 138 |
|
141 | 139 | @Test |
142 | | - void predefinedThreadExecutorIsSelectedForInboundChannel() throws Throwable { |
| 140 | + void predefinedThreadExecutorIsSelectedForInboundChannel() { |
143 | 141 | AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor(); |
144 | 142 | ChannelRegistration registration = new ChannelRegistration(); |
145 | 143 | WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration( |
146 | 144 | new ObjectMapper(), |
147 | 145 | Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor)); |
148 | 146 | configuration.configureClientInboundChannel(registration); |
149 | | - TaskExecutor executor = (TaskExecutor) FieldUtils.getFieldValue(registration, "executor"); |
150 | | - assertThat(executor).isEqualTo(expectedExecutor); |
| 147 | + assertThat(registration).extracting("executor").isEqualTo(expectedExecutor); |
151 | 148 | } |
152 | 149 |
|
153 | 150 | @Test |
154 | | - void predefinedThreadExecutorIsSelectedForOutboundChannel() throws Throwable { |
| 151 | + void predefinedThreadExecutorIsSelectedForOutboundChannel() { |
155 | 152 | AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor(); |
156 | 153 | ChannelRegistration registration = new ChannelRegistration(); |
157 | 154 | WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration( |
158 | 155 | new ObjectMapper(), |
159 | 156 | Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor)); |
160 | 157 | configuration.configureClientOutboundChannel(registration); |
161 | | - TaskExecutor executor = (TaskExecutor) FieldUtils.getFieldValue(registration, "executor"); |
162 | | - assertThat(executor).isEqualTo(expectedExecutor); |
| 158 | + assertThat(registration).extracting("executor").isEqualTo(expectedExecutor); |
163 | 159 | } |
164 | 160 |
|
165 | 161 | private List<MessageConverter> getCustomizedConverters() { |
|
0 commit comments