Replace isAssignableFrom() with isInstance() where feasible#36899
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Replace |
sbrannen
left a comment
There was a problem hiding this comment.
Thanks for making the requested change.
Now I've requested a few additional minor changes.
isAssignableFrom() with isInstance() where feasible
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
Updated, please review. |
sbrannen
left a comment
There was a problem hiding this comment.
You missed several of the test assertions. So I've pointed those out as well as some other minor changes.
|
|
||
| public boolean isNotificationEnabled(Notification notification) { | ||
| return AttributeChangeNotification.class.isAssignableFrom(notification.getClass()); | ||
| return notification instanceof AttributeChangeNotification; |
There was a problem hiding this comment.
| return notification instanceof AttributeChangeNotification; | |
| return (notification instanceof AttributeChangeNotification); |
| @Override | ||
| public boolean supports(Object handler) { | ||
| return WebHandler.class.isAssignableFrom(handler.getClass()); | ||
| return handler instanceof WebHandler; |
There was a problem hiding this comment.
| return handler instanceof WebHandler; | |
| return (handler instanceof WebHandler); |
| @Override | ||
| public boolean supports(Object handler) { | ||
| return WebSocketHandler.class.isAssignableFrom(handler.getClass()); | ||
| return handler instanceof WebSocketHandler; |
There was a problem hiding this comment.
| return handler instanceof WebSocketHandler; | |
| return (handler instanceof WebSocketHandler); |
| @Override | ||
| public boolean supports(Object handler) { | ||
| return handler != null && MyHandler.class.isAssignableFrom(handler.getClass()); | ||
| return handler instanceof MyHandler; |
There was a problem hiding this comment.
| return handler instanceof MyHandler; | |
| return (handler instanceof MyHandler); |
| @Override | ||
| public boolean supports(Object handler) { | ||
| return handler != null && MyHandler.class.isAssignableFrom(handler.getClass()); | ||
| return handler instanceof MyHandler; |
There was a problem hiding this comment.
| return handler instanceof MyHandler; | |
| return (handler instanceof MyHandler); |
|
|
||
| assertThat(map).isNotNull(); | ||
| assertThat(MessageHeaders.class.isAssignableFrom(map.getClass())).as("Actual: " + map.getClass()).isTrue(); | ||
| assertThat(map instanceof MessageHeaders).as("Actual: " + map.getClass()).isTrue(); |
There was a problem hiding this comment.
Please convert ALL instanceof and type.isInstance() assertions in this commit to use assertThat(...).isInstance(...).
At a glance there are 7 or more such occurrences in this PR across various test files.
No description provided.