forked from cucumber/cucumber-jvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cucumber#2491 Support @CucumberContextConfiguration as a meta-annota…
…tion Using @CucumberContextConfiguration as a meta-annotation caused a CucumberBackendException because SpringFactory only realized raw use of the class. Method hasCucumberContextConfiguration does now recognize the use of @CucumberContextConfiguration as meta-annotation or with inheritance. Also SpringBackend#loadGlue filters out abstract classes and interfaces to not try to instantiate what cannot be instantiated.
- Loading branch information
michael
committed
Oct 23, 2022
1 parent
922c1c5
commit c63783b
Showing
6 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ing/src/test/java/io/cucumber/spring/cucontextconfig/AbstractWithComponentAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.cucumber.spring.cucontextconfig; | ||
|
||
import io.cucumber.spring.CucumberContextConfiguration; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
@CucumberContextConfiguration | ||
@ContextConfiguration("classpath:cucumber.xml") | ||
public abstract class AbstractWithComponentAnnotation { | ||
} |
29 changes: 29 additions & 0 deletions
29
cucumber-spring/src/test/java/io/cucumber/spring/cucontextconfig/WithMetaAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.cucumber.spring.cucontextconfig; | ||
|
||
import io.cucumber.spring.CucumberContextConfiguration; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import java.lang.annotation.*; | ||
|
||
@MyTestAnnotation | ||
public class WithMetaAnnotation { | ||
} | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Inherited | ||
|
||
@CucumberContextConfiguration // Required for Cucumber + Spring | ||
@ComponentScan("some.test.stuff") | ||
@ContextConfiguration(classes = SomeGeneralPurposeTestContext.class) | ||
@TestPropertySource(properties = "testprop=value_for_testing") | ||
@ActiveProfiles("test") | ||
@interface MyTestAnnotation { | ||
|
||
} | ||
|
||
class SomeGeneralPurposeTestContext { | ||
} |