mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:30:28 +00:00
Polishing
This commit is contained in:
+6
-5
@@ -30,8 +30,9 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Represents a WebSocket extension as defined in the RFC 6455.
|
||||
* WebSocket extensions add protocol features to the WebSocket protocol. The extensions
|
||||
* Represents a WebSocket extension as defined in RFC 6455.
|
||||
*
|
||||
* <p>WebSocket extensions add protocol features to the WebSocket protocol. The extensions
|
||||
* used within a session are negotiated during the handshake phase as follows:
|
||||
* <ul>
|
||||
* <li>the client may ask for specific extensions in the HTTP handshake request</li>
|
||||
@@ -39,10 +40,10 @@ import org.springframework.util.StringUtils;
|
||||
* </ul>
|
||||
*
|
||||
* <p>WebSocket Extension HTTP headers may include parameters and follow
|
||||
* <a href="https://tools.ietf.org/html/rfc7230#section-3.2">RFC 7230 section 3.2</a></p>
|
||||
* <a href="https://tools.ietf.org/html/rfc7230#section-3.2">RFC 7230 section 3.2</a>
|
||||
*
|
||||
* <p>Note that the order of extensions in HTTP headers defines their order of execution,
|
||||
* for example, extensions "foo, bar" will be executed as "bar(foo(message))".</p>
|
||||
* <p>Note that the order of extensions in HTTP headers defines their order of execution —
|
||||
* for example, extensions "foo, bar" will be executed as "bar(foo(message))".
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @author Juergen Hoeller
|
||||
|
||||
+7
-8
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.entry;
|
||||
|
||||
/**
|
||||
* Test fixture for {@link WebSocketExtension}.
|
||||
@@ -34,13 +35,11 @@ class WebSocketExtensionTests {
|
||||
List<WebSocketExtension> extensions =
|
||||
WebSocketExtension.parseExtensions("x-test-extension ; foo=bar ; bar=baz");
|
||||
|
||||
assertThat(extensions).hasSize(1);
|
||||
WebSocketExtension extension = extensions.get(0);
|
||||
|
||||
assertThat(extension.getName()).isEqualTo("x-test-extension");
|
||||
assertThat(extension.getParameters()).hasSize(2);
|
||||
assertThat(extension.getParameters().get("foo")).isEqualTo("bar");
|
||||
assertThat(extension.getParameters().get("bar")).isEqualTo("baz");
|
||||
assertThat(extensions).singleElement().satisfies(extension -> {
|
||||
assertThat(extension.getName()).isEqualTo("x-test-extension");
|
||||
assertThat(extension.getParameters())
|
||||
.containsOnly(entry("foo", "bar"), entry("bar", "baz"));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -48,7 +47,7 @@ class WebSocketExtensionTests {
|
||||
List<WebSocketExtension> extensions =
|
||||
WebSocketExtension.parseExtensions("x-foo-extension, x-bar-extension");
|
||||
|
||||
assertThat(extensions.stream().map(WebSocketExtension::getName))
|
||||
assertThat(extensions).extracting(WebSocketExtension::getName)
|
||||
.containsExactly("x-foo-extension", "x-bar-extension");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user