|
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. |
|
52 | 52 | import org.springframework.core.annotation.Order; |
53 | 53 | import org.springframework.core.task.AsyncTaskExecutor; |
54 | 54 | import org.springframework.core.task.SimpleAsyncTaskExecutor; |
55 | | -import org.springframework.core.task.TaskExecutor; |
56 | 55 | import org.springframework.messaging.converter.CompositeMessageConverter; |
57 | 56 | import org.springframework.messaging.converter.MessageConverter; |
58 | 57 | import org.springframework.messaging.converter.SimpleMessageConverter; |
|
65 | 64 | import org.springframework.messaging.simp.stomp.StompSession; |
66 | 65 | import org.springframework.messaging.simp.stomp.StompSessionHandler; |
67 | 66 | import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter; |
68 | | -import org.springframework.security.util.FieldUtils; |
69 | 67 | import org.springframework.stereotype.Component; |
70 | 68 | import org.springframework.stereotype.Controller; |
71 | 69 | import org.springframework.web.client.RestTemplate; |
@@ -144,27 +142,25 @@ void customizedConverterTypesMatchDefaultConverterTypes() { |
144 | 142 | } |
145 | 143 |
|
146 | 144 | @Test |
147 | | - void predefinedThreadExecutorIsSelectedForInboundChannel() throws Throwable { |
| 145 | + void predefinedThreadExecutorIsSelectedForInboundChannel() { |
148 | 146 | AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor(); |
149 | 147 | ChannelRegistration registration = new ChannelRegistration(); |
150 | 148 | WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration( |
151 | 149 | new ObjectMapper(), |
152 | 150 | Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor)); |
153 | 151 | configuration.configureClientInboundChannel(registration); |
154 | | - TaskExecutor executor = (TaskExecutor) FieldUtils.getFieldValue(registration, "executor"); |
155 | | - assertThat(executor).isEqualTo(expectedExecutor); |
| 152 | + assertThat(registration).extracting("executor").isEqualTo(expectedExecutor); |
156 | 153 | } |
157 | 154 |
|
158 | 155 | @Test |
159 | | - void predefinedThreadExecutorIsSelectedForOutboundChannel() throws Throwable { |
| 156 | + void predefinedThreadExecutorIsSelectedForOutboundChannel() { |
160 | 157 | AsyncTaskExecutor expectedExecutor = new SimpleAsyncTaskExecutor(); |
161 | 158 | ChannelRegistration registration = new ChannelRegistration(); |
162 | 159 | WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration( |
163 | 160 | new ObjectMapper(), |
164 | 161 | Map.of(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME, expectedExecutor)); |
165 | 162 | configuration.configureClientOutboundChannel(registration); |
166 | | - TaskExecutor executor = (TaskExecutor) FieldUtils.getFieldValue(registration, "executor"); |
167 | | - assertThat(executor).isEqualTo(expectedExecutor); |
| 163 | + assertThat(registration).extracting("executor").isEqualTo(expectedExecutor); |
168 | 164 | } |
169 | 165 |
|
170 | 166 | @Test |
|
0 commit comments