bbejeck commented on code in PR #21567: URL: https://github.com/apache/kafka/pull/21567#discussion_r2849915164
########## streams/src/test/java/org/apache/kafka/streams/state/internals/ChangeLoggingSessionBytesStoreWithHeadersTest.java: ########## @@ -0,0 +1,199 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.streams.state.internals; + +import org.apache.kafka.common.header.internals.RecordHeaders; +import org.apache.kafka.common.serialization.Serdes; +import org.apache.kafka.common.utils.Bytes; +import org.apache.kafka.streams.kstream.Windowed; +import org.apache.kafka.streams.kstream.internals.SessionWindow; +import org.apache.kafka.streams.processor.internals.ProcessorContextImpl; +import org.apache.kafka.streams.processor.internals.ProcessorRecordContext; +import org.apache.kafka.streams.query.Position; +import org.apache.kafka.streams.state.AggregationWithHeaders; +import org.apache.kafka.streams.state.SessionStore; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; + +import static org.apache.kafka.common.utils.Utils.mkEntry; +import static org.apache.kafka.common.utils.Utils.mkMap; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.STRICT_STUBS) +public class ChangeLoggingSessionBytesStoreWithHeadersTest { + + private static final String TOPIC = "topic"; + private static final Position POSITION = Position.fromMap(mkMap(mkEntry("", mkMap(mkEntry(0, 1L))))); + + @Mock + private SessionStore<Bytes, byte[]> inner; + @Mock + private ProcessorContextImpl context; + + private ChangeLoggingSessionBytesStoreWithHeaders store; + + private final byte[] value1 = {0}; + private final Bytes bytesKey = Bytes.wrap(value1); + private final Windowed<Bytes> key1 = new Windowed<>(bytesKey, new SessionWindow(0, 0)); + + private final AggregationWithHeadersSerializer<byte[]> serializer = + new AggregationWithHeadersSerializer<>(Serdes.ByteArray().serializer()); + + @BeforeEach + public void setUp() { + store = new ChangeLoggingSessionBytesStoreWithHeaders(inner); + store.init(context, store); + } + + @AfterEach + public void tearDown() { + verify(inner).init(context, store); + } + + @Test + public void shouldDelegateInit() { + // testing the combination of setUp and tearDown Review Comment: Oversight on my part -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
