File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
main/scala/io/cucumber/scala
test/scala/io/cucumber/scala Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH
2121
2222### Fixed
2323
24+ - [ Scala] Process glue classes distinctly ([ #2582 ] ( https://github.com/cucumber/cucumber-jvm/pull/2582 ) )
25+
2426## [ 8.5.1] (2022-06-24)
2527
2628### Changed
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ class ScalaBackend(
7777 .asScala
7878 )
7979 .filter(glueClass => ! glueClass.isInterface)
80+ .distinct
8081
8182 // Voluntarily throw exception if not able to identify if it's a class
8283 val (clsClasses, objClasses) =
Original file line number Diff line number Diff line change @@ -182,6 +182,32 @@ class ScalaBackendTest {
182182 verify(fakeLookup, never()).getInstance(any())
183183 }
184184
185+ @ Test
186+ def loadGlueAndBuildWorld_once_by_classpath_url (): Unit = {
187+ // Load glue
188+ backend.loadGlue(
189+ fakeGlue,
190+ List (
191+ URI .create(" classpath:io/cucumber/scala/steps/classes" ),
192+ URI .create(" classpath:io/cucumber/scala/steps/classes" )
193+ ).asJava
194+ )
195+
196+ assertEquals(3 , backend.scalaGlueClasses.size)
197+ assertTrue(
198+ backend.scalaGlueClasses.toSet == Set (
199+ classOf [StepsA ],
200+ classOf [StepsB ],
201+ classOf [StepsC ]
202+ )
203+ )
204+
205+ verify(fakeContainer, times(3 )).addClass(any())
206+ verify(fakeContainer, times(1 )).addClass(classOf [StepsA ])
207+ verify(fakeContainer, times(1 )).addClass(classOf [StepsB ])
208+ verify(fakeContainer, times(1 )).addClass(classOf [StepsC ])
209+ }
210+
185211 @ Test
186212 def loadGlueAndBuildWorld_class_incorrect_hooks_definitions (): Unit = {
187213 val result = Try {
You can’t perform that action at this time.
0 commit comments