20
20
import static org .hamcrest .Matchers .startsWith ;
21
21
import static org .junit .jupiter .api .Assertions .assertThrows ;
22
22
23
- public class ConfigurationFormCallTest {
23
+ class ConfigurationFormCallTest {
24
24
25
25
private static final String CONFIGURATION =
26
26
"hostName: " + HOST_NAME + "\n " +
@@ -72,7 +72,7 @@ public void setUp() {
72
72
}
73
73
74
74
@ Test
75
- public void whenNoConfigurationSpecified_reportFailure () {
75
+ void whenNoConfigurationSpecified_reportFailure () {
76
76
assertThrows (RuntimeException .class , () -> handleConfigurationFormCall (context ));
77
77
}
78
78
@@ -83,35 +83,35 @@ private void handleConfigurationFormCall(InvocationContextStub context) throws I
83
83
}
84
84
85
85
@ Test
86
- public void whenRequestUsesHttp_authenticateWithHttp () throws Exception {
86
+ void whenRequestUsesHttp_authenticateWithHttp () throws Exception {
87
87
handleConfigurationFormCall (context .withConfigurationForm ("replace" , CONFIGURATION ));
88
88
89
89
assertThat (factory .getClientUrl (), startsWith ("http:" ));
90
90
}
91
91
92
92
@ Test
93
- public void whenRequestUsesHttps_authenticateWithHttps () throws Exception {
93
+ void whenRequestUsesHttps_authenticateWithHttps () throws Exception {
94
94
handleConfigurationFormCall (context .withHttps ().withConfigurationForm ("replace" , CONFIGURATION ));
95
95
96
96
assertThat (factory .getClientUrl (), startsWith ("https:" ));
97
97
}
98
98
99
99
@ Test
100
- public void afterUploadWithReplace_useNewConfiguration () throws Exception {
100
+ void afterUploadWithReplace_useNewConfiguration () throws Exception {
101
101
handleConfigurationFormCall (context .withConfigurationForm ("replace" , CONFIGURATION ));
102
102
103
103
assertThat (LiveConfiguration .asString (), equalTo (CONFIGURATION ));
104
104
}
105
105
106
106
@ Test
107
- public void afterUpload_redirectToMainPage () throws Exception {
107
+ void afterUpload_redirectToMainPage () throws Exception {
108
108
handleConfigurationFormCall (context .withConfigurationForm ("replace" , CONFIGURATION ));
109
109
110
110
assertThat (context .getRedirectLocation (), equalTo (WebAppConstants .MAIN_PAGE ));
111
111
}
112
112
113
113
@ Test
114
- public void whenRestPortInaccessible_switchToSpecifiedPort () throws Exception {
114
+ void whenRestPortInaccessible_switchToSpecifiedPort () throws Exception {
115
115
LiveConfiguration .loadFromString (CONFIGURATION_WITH_REST_PORT );
116
116
factory .throwConnectionFailure ("localhost" , REST_PORT );
117
117
@@ -121,14 +121,14 @@ public void whenRestPortInaccessible_switchToSpecifiedPort() throws Exception {
121
121
}
122
122
123
123
@ Test
124
- public void afterUploadWithAppend_useCombinedConfiguration () throws Exception {
124
+ void afterUploadWithAppend_useCombinedConfiguration () throws Exception {
125
125
handleConfigurationFormCall (context .withConfigurationForm ("append" , ADDED_CONFIGURATION ));
126
126
127
127
assertThat (LiveConfiguration .asString (), equalTo (COMBINED_CONFIGURATION ));
128
128
}
129
129
130
130
@ Test
131
- public void whenSelectedFileIsNotYaml_reportError () throws Exception {
131
+ void whenSelectedFileIsNotYaml_reportError () throws Exception {
132
132
handleConfigurationFormCall (context .withConfigurationForm ("replace" , NON_YAML ));
133
133
134
134
assertThat (context .getResponse (), containsString (ConfigurationException .NOT_YAML_FORMAT ));
@@ -138,7 +138,7 @@ public void whenSelectedFileIsNotYaml_reportError() throws Exception {
138
138
"this is not yaml\n " ;
139
139
140
140
@ Test
141
- public void whenSelectedFileHasPartialYaml_reportError () throws Exception {
141
+ void whenSelectedFileHasPartialYaml_reportError () throws Exception {
142
142
handleConfigurationFormCall (context .withConfigurationForm ("replace" , PARTIAL_YAML ));
143
143
144
144
assertThat (context .getResponse (), containsString (ConfigurationException .BAD_YAML_FORMAT ));
@@ -148,7 +148,7 @@ public void whenSelectedFileHasPartialYaml_reportError() throws Exception {
148
148
"queries:\n key name\n " ;
149
149
150
150
@ Test
151
- public void whenSelectedFileHasBadBooleanValue_reportError () throws Exception {
151
+ void whenSelectedFileHasBadBooleanValue_reportError () throws Exception {
152
152
handleConfigurationFormCall (context .withConfigurationForm ("append" , ADDED_CONFIGURATION_WITH_BAD_BOOLEAN ));
153
153
154
154
assertThat (context .getResponse (), containsString (BAD_BOOLEAN_STRING ));
@@ -162,14 +162,14 @@ public void whenSelectedFileHasBadBooleanValue_reportError() throws Exception {
162
162
" values: [age, sex]\n " ;
163
163
164
164
@ Test
165
- public void afterSelectedFileHasBadBooleanValue_configurationIsUnchanged () throws Exception {
165
+ void afterSelectedFileHasBadBooleanValue_configurationIsUnchanged () throws Exception {
166
166
handleConfigurationFormCall (context .withConfigurationForm ("append" , ADDED_CONFIGURATION_WITH_BAD_BOOLEAN ));
167
167
168
168
assertThat (LiveConfiguration .asString (), equalTo (CONFIGURATION ));
169
169
}
170
170
171
171
@ Test
172
- public void whenServerSends403StatusOnGet_returnToClient () throws Exception {
172
+ void whenServerSends403StatusOnGet_returnToClient () throws Exception {
173
173
factory .reportNotAuthorized ();
174
174
175
175
handleConfigurationFormCall (context .withConfigurationForm ("replace" , CONFIGURATION ));
@@ -178,7 +178,7 @@ public void whenServerSends403StatusOnGet_returnToClient() throws Exception {
178
178
}
179
179
180
180
@ Test
181
- public void whenServerSends401StatusOnGet_returnToClient () throws Exception {
181
+ void whenServerSends401StatusOnGet_returnToClient () throws Exception {
182
182
factory .reportAuthenticationRequired ("Test-Realm" );
183
183
184
184
handleConfigurationFormCall (context .withConfigurationForm ("replace" , CONFIGURATION ));
0 commit comments