Skip to content

Commit

Permalink
Added unit test case
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Kondaka <[email protected]>
  • Loading branch information
kkondaka committed Nov 4, 2024
1 parent e44bfbe commit 7aab647
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Objects;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doNothing;
Expand Down Expand Up @@ -130,6 +131,7 @@ void setUp() throws Exception {
when(sourceConfig.getTopics()).thenReturn((List) List.of(topic1, topic2));
when(sourceConfig.getSchemaConfig()).thenReturn(null);
when(sourceConfig.getEncryptionConfig()).thenReturn(encryptionConfig);
when(sourceConfig.getAcknowledgementsEnabled()).thenReturn(false);
when(encryptionConfig.getType()).thenReturn(EncryptionType.NONE);
}

Expand Down Expand Up @@ -163,6 +165,15 @@ void test_kafkaSource_basicFunctionality() {
assertTrue(Objects.nonNull(kafkaSource));
kafkaSource.start(buffer);
assertTrue(Objects.nonNull(kafkaSource.getConsumer()));
assertFalse(kafkaSource.areAcknowledgementsEnabled());
}

@Test
void test_kafkaSource_withAcknowledgements() {
when(sourceConfig.getAcknowledgementsEnabled()).thenReturn(true);
kafkaSource = createObjectUnderTest();
assertTrue(Objects.nonNull(kafkaSource));
assertTrue(kafkaSource.areAcknowledgementsEnabled());
}

@Test
Expand Down

0 comments on commit 7aab647

Please sign in to comment.