Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.pactflow.example.kafka;

import org.springframework.messaging.Message;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.support.MessageBuilder;

Expand All @@ -15,7 +15,7 @@ public ProductMessageBuilder withProduct(ProductEvent product) {
return this;
}

public Message<String> build() throws JsonProcessingException {
public Message<String> build() throws JacksonException {
return MessageBuilder.withPayload(this.mapper.writeValueAsString(this.product))
.setHeader(KafkaHeaders.TOPIC, "products").setHeader("Content-Type", "application/json; charset=utf-8")
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.pactflow.example.kafka;

import com.fasterxml.jackson.core.JsonProcessingException;
import tools.jackson.core.JacksonException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -22,7 +22,7 @@ public void save(final ProductEvent product) {
Message<String> message = new ProductMessageBuilder().withProduct(product).build();
this.template.send(message);

} catch (final JsonProcessingException e) {
} catch (final JacksonException e) {
logger.error("unable to serialise product to JSON", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.HashMap;

import com.fasterxml.jackson.core.JsonProcessingException;
import tools.jackson.core.JacksonException;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestTemplate;
Expand All @@ -42,15 +42,15 @@ void before(PactVerificationContext context) {
}

@PactVerifyProvider("a product event update")
public MessageAndMetadata productUpdateEvent() throws JsonProcessingException {
public MessageAndMetadata productUpdateEvent() throws JacksonException {
ProductEvent product = new ProductEvent("id1", "product name", "product type", "v1", EventType.UPDATED, 15.00);
Message<String> message = new ProductMessageBuilder().withProduct(product).build();

return generateMessageAndMetadata(message);
}

@PactVerifyProvider("a product created event")
public MessageAndMetadata productCreatedEvent() throws JsonProcessingException {
public MessageAndMetadata productCreatedEvent() throws JacksonException {
ProductEvent product = new ProductEvent("id1", "product name", "product type", "v1", EventType.CREATED, 27.00);
Message<String> message = new ProductMessageBuilder().withProduct(product).build();

Expand Down