18
18
package ru .mystamps .web .support .spring .security ;
19
19
20
20
import org .assertj .core .api .WithAssertions ;
21
- import org .junit .Rule ;
22
- import org .junit .Test ;
21
+ import org .junit .jupiter .api .Test ;
23
22
import org .springframework .mock .web .MockHttpServletRequest ;
24
23
import org .springframework .mock .web .MockHttpServletResponse ;
25
- import org .togglz .junit .TogglzRule ;
24
+ import org .togglz .junit5 .AllEnabled ;
25
+ import org .togglz .testing .TestFeatureManager ;
26
26
import ru .mystamps .web .feature .site .SiteUrl ;
27
27
import ru .mystamps .web .support .togglz .Features ;
28
28
import ru .mystamps .web .tests .Random ;
@@ -41,15 +41,13 @@ public class ContentSecurityPolicyHeaderWriterTest implements WithAssertions {
41
41
private static final int NUMBER_OF_DIRECTIVES_ON_H2_CONSOLE_PAGE = 7 ;
42
42
private static final String H2_CONSOLE_PATH = "/console/" ;
43
43
44
- @ Rule
45
- public TogglzRule togglz = TogglzRule .allEnabled (Features .class );
46
-
47
44
//
48
45
// Tests for writeHeaders()
49
46
//
50
47
51
48
@ Test
52
- public void writeContentSecurityPolicyHeader () {
49
+ @ AllEnabled (Features .class )
50
+ public void writeContentSecurityPolicyHeader (TestFeatureManager featureManager ) {
53
51
// given
54
52
ContentSecurityPolicyHeaderWriter writer = new ContentSecurityPolicyHeaderWriter (
55
53
bool (),
@@ -68,7 +66,7 @@ public void writeContentSecurityPolicyHeader() {
68
66
assertThat (header .split (";" )).hasSize (NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES );
69
67
70
68
// when
71
- togglz .disable (Features .CSP_REPORT_ONLY );
69
+ featureManager .disable (Features .CSP_REPORT_ONLY );
72
70
writer .writeHeaders (request , response );
73
71
// then
74
72
header = response .getHeader ("Content-Security-Policy" );
0 commit comments