I made a java lib project with all steps classes to be used in other project
package ulala.aop.integration.steps;
public class KafkaSteps {
@Autowired
private BinderAwareChannelResolver resolver;
@Autowired
private MessageChannel localOutput, throttlingOutput;
@Autowired
private ApplicationContext applicationContext;
private MessageBuilder messageBuilder;
private MessageChannel messageChannel;
private String message;
@Given("{string} topic destination to notify")
public void kafkaServerWithTopic(String destination) {
messageChannel = resolver.resolveDestination(destination);
}
...
The configuration is the follow
package ulala.aop.integration.boot;
@SpringBootTest
@AutoConfigureMockMvc
@CucumberContextConfiguration
public class CucumberConfiguration {
}
I added the dependency on the main spring-boot project. The project has a rest controller , the features.
On the rest class I execute the feature like this
String response = String.valueOf(Main.run(new String[]{"--glue",
"ulala.aop.integration.steps",
"classpath:features/local/notify.feature"}
, Thread.currentThread().getContextClassLoader()));
And the feature is the follow:
Scenario: Notify on kafka
Given "integration.test.in" topic destination to notify
Then add message to notify
| field | value |
| test field | value field |
And add header "headerTest" with value "integration.header"
And notify kafka
I am getting a nullpointerexception
This fallback has beep deprecated. Please annotate a glue class with some context configuration.
For example:
@@CucumberContextConfiguration
@SpringBootTest(classes = TestConfig.class)
public class CucumberSpringConfiguration { }
Or:
@@CucumberContextConfiguration
@ContextConfiguration( ... )
public class CucumberSpringConfiguration { }
F---
Failed scenarios:
classpath:features/local/notify.feature:17# Notify on kafka
1 Scenarios (1 failed)
4 Steps (1 failed, 3 skipped)
0m0.105s
java.lang.NullPointerException
at pnc.aop.integration.steps.KafkaSteps.kafkaServerWithTopic(KafkaSteps.java:38)