From e4dc33809c445ddde71747a8ada1fdab891f3db8 Mon Sep 17 00:00:00 2001 From: Hussain Kara Fallah Date: Tue, 6 Aug 2024 13:23:09 +0300 Subject: [PATCH] spotbugs happy --- .../com/transferwise/kafka/tkms/MessageDecorationTest.java | 2 +- .../com/transferwise/kafka/tkms/test/TestMessageDecorator.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/MessageDecorationTest.java b/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/MessageDecorationTest.java index 27fc2ac..6768f08 100644 --- a/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/MessageDecorationTest.java +++ b/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/MessageDecorationTest.java @@ -58,7 +58,7 @@ void messagesAreDecorateWithJambi() { private void checkForHeader(SentMessage sentMessage, String key, String value) { assertTrue( StreamSupport.stream(sentMessage.getProducerRecord().headers().spliterator(), false) - .anyMatch(h -> h.key().equals(key) && value.equals(new String(h.value()))) + .anyMatch(h -> h.key().equals(key) && value.equals(new String(h.value(), StandardCharsets.UTF_8))) ); } } diff --git a/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/test/TestMessageDecorator.java b/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/test/TestMessageDecorator.java index 6353b3b..10147e3 100644 --- a/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/test/TestMessageDecorator.java +++ b/tw-tkms-starter/src/test/java/com/transferwise/kafka/tkms/test/TestMessageDecorator.java @@ -3,6 +3,7 @@ import com.transferwise.kafka.tkms.api.ITkmsMessageDecorator; import com.transferwise.kafka.tkms.api.TkmsMessage; import com.transferwise.kafka.tkms.api.TkmsMessage.Header; +import java.nio.charset.StandardCharsets; import java.util.List; import org.springframework.stereotype.Component; @@ -11,7 +12,7 @@ public class TestMessageDecorator implements ITkmsMessageDecorator { @Override public List
getHeaders(TkmsMessage message) { - var h1 = new Header().setKey("tool").setValue("jambi".getBytes()); + var h1 = new Header().setKey("tool").setValue("jambi".getBytes(StandardCharsets.UTF_8)); if (message.getKey() == null) { return List.of(); }