Closed thomas-chauvet closed 5 years ago
I encountered a similar problem, and it turned out to be a serialization issue. The topology was picking up values as byte arrays when I wanted strings. I solved it by passing in a configuration when building MockedStreams
. For example:
import com.madewithtea.mockedstreams.MockedStreams
import org.apache.kafka.streams.StreamsConfig
import org.apache.kafka.common.serialization.Serdes
val strings = Serdes.String()
val props = new java.util.Properties();
props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, strings.getClass().getName())
props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, strings.getClass().getName())
val mockedStreams = MockedStreams()
.config(props)
// Set topology, inputs, and outputs here
Indeed, specifying Serdes.String doesn't propagate properly, it assumes Array[Byte] no matter what.
Thanks for your answer @blakeney I will try it !
Can we close it? :)
I am trying to unit test Kafka Stream with the library.
To test a simple example, I just want to convert string into upper case.
I try the code below :
I get an error avout java.lang.String :
It seems weird, because Scala String and Java String should be identical.