[ 
https://issues.apache.org/jira/browse/KAFKA-15143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17739671#comment-17739671
 ] 

Tomasz Kaszuba commented on KAFKA-15143:
----------------------------------------

I have worked around the issue by creating the following class.
{code:java}
class MockFixedKeyProcessorContext[KForward, VForward]
    extends MockProcessorContext[KForward, VForward]
    with FixedKeyProcessorContext[KForward, VForward] {

  override def forward[K <: KForward, V <: VForward](record: FixedKeyRecord[K, 
V]): Unit =
    super.forward(new Record(record.key(), record.value(), record.timestamp(), 
record.headers()))

  override def forward[K <: KForward, V <: VForward](record: FixedKeyRecord[K, 
V], childName: String): Unit =
    super.forward(new Record(record.key(), record.value(), record.timestamp(), 
record.headers()), childName)
} {code}

> MockFixedKeyProcessorContext is missing from test-utils
> -------------------------------------------------------
>
>                 Key: KAFKA-15143
>                 URL: https://issues.apache.org/jira/browse/KAFKA-15143
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams-test-utils
>    Affects Versions: 3.5.0
>            Reporter: Tomasz Kaszuba
>            Priority: Major
>
> I am trying to test a ContextualFixedKeyProcessor but it is not possible to 
> call the init method from within a unit test since the MockProcessorContext 
> doesn't implement  
> {code:java}
> FixedKeyProcessorContext<KForward, VForward> {code}
> but only
> {code:java}
> ProcessorContext<KForward, VForward>
> {code}
> Shouldn't there also be a *MockFixedKeyProcessorContext* in the test utils?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to