1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2021 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.
18
18
19
19
import java .util .List ;
20
20
21
+ import org .glassfish .tyrus .core .TyrusExtension ;
21
22
import org .junit .jupiter .api .Test ;
22
23
24
+ import org .springframework .web .socket .adapter .standard .StandardToWebSocketExtensionAdapter ;
25
+
23
26
import static org .assertj .core .api .Assertions .assertThat ;
24
27
25
28
/**
@@ -30,7 +33,9 @@ public class WebSocketExtensionTests {
30
33
31
34
@ Test
32
35
public void parseHeaderSingle () {
33
- List <WebSocketExtension > extensions = WebSocketExtension .parseExtensions ("x-test-extension ; foo=bar ; bar=baz" );
36
+ List <WebSocketExtension > extensions =
37
+ WebSocketExtension .parseExtensions ("x-test-extension ; foo=bar ; bar=baz" );
38
+
34
39
assertThat (extensions ).hasSize (1 );
35
40
WebSocketExtension extension = extensions .get (0 );
36
41
@@ -42,9 +47,18 @@ public void parseHeaderSingle() {
42
47
43
48
@ Test
44
49
public void parseHeaderMultiple () {
45
- List <WebSocketExtension > extensions = WebSocketExtension .parseExtensions ("x-foo-extension, x-bar-extension" );
50
+ List <WebSocketExtension > extensions =
51
+ WebSocketExtension .parseExtensions ("x-foo-extension, x-bar-extension" );
52
+
46
53
assertThat (extensions .stream ().map (WebSocketExtension ::getName ))
47
54
.containsExactly ("x-foo-extension" , "x-bar-extension" );
48
55
}
49
56
57
+ @ Test // gh-26449
58
+ public void equality () {
59
+ WebSocketExtension ext1 = new WebSocketExtension ("myExtension" );
60
+ WebSocketExtension ext2 = new StandardToWebSocketExtensionAdapter (new TyrusExtension ("myExtension" ));
61
+
62
+ assertThat (ext1 ).isEqualTo (ext2 );
63
+ }
50
64
}
0 commit comments