You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write provider test for kafka communications. I am using Pact-JVM with gradle dependency group:'au.com.dius.pact.provider', name: 'spring', version: '4.1.41' and plugin au.com.dius.pact.gradle.plugin:4.1.41 with JUnit4 for jdk8 framework.
I am getting error 'No annotated methods were found interaction 'Valid message'. You need to provide a method annotated with @PactVerifyProvider("Valid message") on the classpath that returns the message contents.' while running the provider test. My provider test has the same annotated method already present as suggested in the error message.
Below is my provider test:
package consumer.order;
@Provider("order-service")
@Consumer("accounts")
@PactFolder("src/contractTest/resources/pacts/")
@RunWith(PactRunner.class)
public class PublishOrderDetailsTest{
@TestTarget
public final Target target = new MessageTarget(Collections.singletonList("consumer.order.*"));
@Before
public void before(){}
@State("Publish order details")
public void publishOrderDetails(){}
@PactVerifyProvider("Valid message")
public MessageAndMetadata verifyOrderDetailsPubished(){
OrderDetials orderDetails = new OrderDetails("id123", "$200.00", "2024-03-12", "newyork", washington");
Map<String, Object> metaData = new HashMap<>();
metaData.put("contentType", "application/json");
metaData.put("topic", "order-details");
JsonSerializer<OrderDetials> serializer = new JsonSerializer<>();
return new MessageAndMetadata(serializer.serialize("order-details", orderDetails), metaData);
}
}
All values are matched as provided in the pact. InteractionRunner of pact is able to get the details from Pact files and also the details of method under @PactVerifyProvider annotation is getting picked through reflection but the run is, somehow, giving error 'No annotated methods were found for interaction 'Valid message''.
I am stuck at this error and I am new to pact. Can someone please suggest how to fix this issue?
The text was updated successfully, but these errors were encountered:
It gives error when I am trying to use a customised Serializer of Kafka to convert the message to bytes in order to set the instance of MessageAndMetadata. However, the test works fine if I convert OrderDetails instance to String and then to bytes inside MessageAndMetadata.
I am trying to write provider test for kafka communications. I am using Pact-JVM with gradle dependency
group:'au.com.dius.pact.provider', name: 'spring', version: '4.1.41'
and pluginau.com.dius.pact.gradle.plugin:4.1.41
with JUnit4 for jdk8 framework.I am getting error 'No annotated methods were found interaction 'Valid message'. You need to provide a method annotated with @PactVerifyProvider("Valid message") on the classpath that returns the message contents.' while running the provider test. My provider test has the same annotated method already present as suggested in the error message.
Below is my provider test:
All values are matched as provided in the pact. InteractionRunner of pact is able to get the details from Pact files and also the details of method under @PactVerifyProvider annotation is getting picked through reflection but the run is, somehow, giving error 'No annotated methods were found for interaction 'Valid message''.
I am stuck at this error and I am new to pact. Can someone please suggest how to fix this issue?
The text was updated successfully, but these errors were encountered: