4
4
import com .ionos .go .plugin .notifier .message .outgoing .ValidateConfigurationResponse ;
5
5
import com .thoughtworks .go .plugin .api .response .GoPluginApiResponse ;
6
6
import org .apache .hc .core5 .http .HttpStatus ;
7
- import org .junit .Before ;
8
- import org .junit .Test ;
7
+ import org .junit .jupiter . api . BeforeEach ;
8
+ import org .junit .jupiter . api . Test ;
9
9
10
10
import java .util .Collections ;
11
11
import java .util .HashMap ;
12
12
import java .util .Map ;
13
13
14
- import static org .junit .Assert .assertEquals ;
15
- import static org .junit .Assert .assertNotNull ;
16
- import static org .junit .Assert .assertTrue ;
14
+ import static org .junit .jupiter . api . Assertions .assertEquals ;
15
+ import static org .junit .jupiter . api . Assertions .assertNotNull ;
16
+ import static org .junit .jupiter . api . Assertions .assertTrue ;
17
17
18
18
public class GoNotifierPluginValidateConfigurationTest extends GoNotifierPluginBase {
19
19
20
20
private ValidateConfigurationRequest request ;
21
21
22
- @ Before
22
+ @ BeforeEach
23
23
public void setupTest () {
24
24
request = new ValidateConfigurationRequest ();
25
25
}
26
26
27
27
@ Test
28
- public void testHandleValidateConfigurationWithBadRequest () {
28
+ void testHandleValidateConfigurationWithBadRequest () {
29
29
GoPluginApiResponse response = getGoNotifierPlugin ().handle (
30
30
GoCdObjects .request (Constants .PLUGIN_VALIDATE_CONFIGURATION , getGson ().toJson (request )));
31
31
assertNotNull (response );
@@ -34,7 +34,7 @@ public void testHandleValidateConfigurationWithBadRequest() {
34
34
}
35
35
36
36
@ Test
37
- public void testHandleValidateConfigurationWithGoodRequestMultipleErrors () {
37
+ void testHandleValidateConfigurationWithGoodRequestMultipleErrors () {
38
38
request .setPluginSettings (new HashMap <>());
39
39
GoPluginApiResponse response = getGoNotifierPlugin ().handle (
40
40
GoCdObjects .request (Constants .PLUGIN_VALIDATE_CONFIGURATION , getGson ().toJson (request )));
@@ -47,7 +47,7 @@ public void testHandleValidateConfigurationWithGoodRequestMultipleErrors() {
47
47
}
48
48
49
49
@ Test
50
- public void testHandleValidateConfigurationWithGoodRequestNoErrors () {
50
+ void testHandleValidateConfigurationWithGoodRequestNoErrors () {
51
51
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
52
52
request .setPluginSettings (pluginSettings );
53
53
GoPluginApiResponse response = getGoNotifierPlugin ().handle (
@@ -60,7 +60,7 @@ public void testHandleValidateConfigurationWithGoodRequestNoErrors() {
60
60
}
61
61
62
62
@ Test
63
- public void testHandleValidateConfigurationWithMalformedCondition () {
63
+ void testHandleValidateConfigurationWithMalformedCondition () {
64
64
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
65
65
pluginSettings .put (Constants .PARAM_CONDITION , Collections .singletonMap (Constants .FIELD_VALUE , "${ error" ));
66
66
request .setPluginSettings (pluginSettings );
@@ -75,7 +75,7 @@ public void testHandleValidateConfigurationWithMalformedCondition() {
75
75
}
76
76
77
77
@ Test
78
- public void testHandleValidateConfigurationWithMalformedTemplate () {
78
+ void testHandleValidateConfigurationWithMalformedTemplate () {
79
79
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
80
80
pluginSettings .put (Constants .PARAM_TEMPLATE , Collections .singletonMap (Constants .FIELD_VALUE , "${ error" ));
81
81
request .setPluginSettings (pluginSettings );
@@ -90,7 +90,7 @@ public void testHandleValidateConfigurationWithMalformedTemplate() {
90
90
}
91
91
92
92
@ Test
93
- public void testHandleValidateConfigurationWithTemplateAccessingUndefinedProperty () {
93
+ void testHandleValidateConfigurationWithTemplateAccessingUndefinedProperty () {
94
94
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
95
95
pluginSettings .put (Constants .PARAM_TEMPLATE , Collections .singletonMap (Constants .FIELD_VALUE , "${ doesntexist.foobar }" ));
96
96
request .setPluginSettings (pluginSettings );
@@ -105,7 +105,7 @@ public void testHandleValidateConfigurationWithTemplateAccessingUndefinedPropert
105
105
}
106
106
107
107
@ Test
108
- public void testHandleValidateConfigurationWithConditionAccessingUndefinedProperty () {
108
+ void testHandleValidateConfigurationWithConditionAccessingUndefinedProperty () {
109
109
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
110
110
pluginSettings .put (Constants .PARAM_CONDITION , Collections .singletonMap (Constants .FIELD_VALUE , "${ doesntexist.foobar }" ));
111
111
request .setPluginSettings (pluginSettings );
@@ -120,7 +120,7 @@ public void testHandleValidateConfigurationWithConditionAccessingUndefinedProper
120
120
}
121
121
122
122
@ Test
123
- public void testHandleValidateConfigurationWithConditionNotTrueOrFalse () {
123
+ void testHandleValidateConfigurationWithConditionNotTrueOrFalse () {
124
124
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
125
125
pluginSettings .put (Constants .PARAM_CONDITION , Collections .singletonMap (Constants .FIELD_VALUE , "tralse" ));
126
126
request .setPluginSettings (pluginSettings );
@@ -132,11 +132,11 @@ public void testHandleValidateConfigurationWithConditionNotTrueOrFalse() {
132
132
ValidateConfigurationResponse [] validateConfigurationResponses = getGson ().fromJson (response .responseBody (), ValidateConfigurationResponse [].class );
133
133
assertEquals (1 , validateConfigurationResponses .length );
134
134
assertEquals (Constants .PARAM_CONDITION , validateConfigurationResponses [0 ].getKey ());
135
- assertTrue ("Should contain 'true or false'" , validateConfigurationResponses [0 ].getMessage ().contains ("true or false" ));
135
+ assertTrue (validateConfigurationResponses [0 ].getMessage ().contains ("true or false" ), "Should contain 'true or false'" );
136
136
}
137
137
138
138
@ Test
139
- public void testHandleValidateConfigurationWithMalformedProxyUrl () {
139
+ void testHandleValidateConfigurationWithMalformedProxyUrl () {
140
140
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
141
141
pluginSettings .put (Constants .PARAM_PROXY_URL , Collections .singletonMap (Constants .FIELD_VALUE , "hppt://foo.bar" ));
142
142
request .setPluginSettings (pluginSettings );
@@ -152,7 +152,7 @@ public void testHandleValidateConfigurationWithMalformedProxyUrl() {
152
152
}
153
153
154
154
@ Test
155
- public void testHandleValidateConfigurationWithMalformedWebhookUrl () {
155
+ void testHandleValidateConfigurationWithMalformedWebhookUrl () {
156
156
Map <String , Map <String , String >> pluginSettings = newGoodPluginSettingsTemplate ();
157
157
pluginSettings .put (Constants .PARAM_WEBHOOK_URL , Collections .singletonMap (Constants .FIELD_VALUE , "hppt://foo.bar" ));
158
158
request .setPluginSettings (pluginSettings );
0 commit comments