Polish "Use idiomatic AssertJ map assertions"
See gh-31752
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.messaging;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@@ -153,9 +152,7 @@ public class MessageHeadersTests {
|
||||
map.put("key1", "val1");
|
||||
map.put("key2", 123);
|
||||
MessageHeaders headers = new MessageHeaders(map);
|
||||
Set<String> keys = headers.keySet();
|
||||
assertThat(keys.contains("key1")).isTrue();
|
||||
assertThat(keys.contains("key2")).isTrue();
|
||||
assertThat(headers).containsKeys("key1", "key2");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,7 +66,6 @@ public class MethodMessageHandlerTests {
|
||||
TestMethodMessageHandler messageHandler = initMethodMessageHandler(TestController.class);
|
||||
Map<String, HandlerMethod> mappings = messageHandler.getHandlerMethods();
|
||||
|
||||
assertThat(mappings.keySet()).hasSize(5);
|
||||
assertThat(mappings).containsOnlyKeys(
|
||||
"/handleMessage", "/handleMessageWithArgument", "/handleMessageWithError",
|
||||
"/handleMessageMatch1", "/handleMessageMatch2");
|
||||
|
||||
@@ -157,8 +157,7 @@ public class MessageHeaderAccessorTests {
|
||||
headers.copyHeaders(null);
|
||||
headers.copyHeadersIfAbsent(null);
|
||||
|
||||
assertThat(headers.getMessageHeaders()).hasSize(1);
|
||||
assertThat(headers.getMessageHeaders().keySet()).isEqualTo(Collections.singleton("id"));
|
||||
assertThat(headers.getMessageHeaders()).containsOnlyKeys(Collections.singleton("id"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user