@@ -150,6 +150,44 @@ private void assertPluginExists(List<Plugin> plugins, String pluginName) {
150
150
assertTrue (pluginName + " not found among the plugins" , found );
151
151
}
152
152
153
+ @ Test
154
+ public void create_with_glue () {
155
+ RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory (ClassWithGlue .class );
156
+ RuntimeOptions runtimeOptions = runtimeOptionsFactory .create ();
157
+
158
+ assertEquals (asList ("app.features.user.registration" , "app.features.hooks" ), runtimeOptions .getGlue ());
159
+ }
160
+
161
+ @ Test
162
+ public void create_with_extra_glue () {
163
+ RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory (ClassWithExtraGlue .class );
164
+ RuntimeOptions runtimeOptions = runtimeOptionsFactory .create ();
165
+
166
+ assertEquals (asList ("app.features.hooks" , "classpath:cucumber/runtime" ), runtimeOptions .getGlue ());
167
+ }
168
+
169
+ @ Test
170
+ public void create_with_extra_glue_in_subclass_of_extra_glue () {
171
+ RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory (SubClassWithExtraGlueOfExtraGlue .class );
172
+ RuntimeOptions runtimeOptions = runtimeOptionsFactory .create ();
173
+
174
+ assertEquals (asList ("app.features.user.hooks" , "app.features.hooks" , "classpath:cucumber/runtime" ), runtimeOptions .getGlue ());
175
+ }
176
+
177
+ @ Test
178
+ public void create_with_extra_glue_in_subclass_of_glue () {
179
+ RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory (SubClassWithExtraGlueOfGlue .class );
180
+ RuntimeOptions runtimeOptions = runtimeOptionsFactory .create ();
181
+
182
+ assertEquals (asList ("app.features.user.hooks" , "app.features.user.registration" , "app.features.hooks" ), runtimeOptions .getGlue ());
183
+ }
184
+
185
+ @ Test (expected = CucumberException .class )
186
+ public void cannot_create_with_glue_and_extra_glue () {
187
+ RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory (ClassWithGlueAndExtraGlue .class );
188
+ runtimeOptionsFactory .create ();
189
+ }
190
+
153
191
154
192
@ CucumberOptions (snippets = SnippetType .CAMELCASE )
155
193
private static class Snippets {
@@ -218,4 +256,29 @@ private static class ClassWithJunitOption {
218
256
// empty
219
257
}
220
258
259
+ @ CucumberOptions (glue = {"app.features.user.registration" , "app.features.hooks" })
260
+ private static class ClassWithGlue {
261
+ // empty
262
+ }
263
+
264
+ @ CucumberOptions (extraGlue = {"app.features.hooks" })
265
+ private static class ClassWithExtraGlue {
266
+ // empty
267
+ }
268
+
269
+ @ CucumberOptions (extraGlue = {"app.features.user.hooks" })
270
+ private static class SubClassWithExtraGlueOfExtraGlue extends ClassWithExtraGlue {
271
+ // empty
272
+ }
273
+
274
+ @ CucumberOptions (extraGlue = {"app.features.user.hooks" })
275
+ private static class SubClassWithExtraGlueOfGlue extends ClassWithGlue {
276
+ // empty
277
+ }
278
+
279
+ @ CucumberOptions (extraGlue = {"app.features.hooks" }, glue = {"app.features.user.registration" })
280
+ private static class ClassWithGlueAndExtraGlue {
281
+ // empty
282
+ }
283
+
221
284
}
0 commit comments