kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-4661: Improve test coverage UsePreviousTimeOnInvalidTimestamp
Date Sat, 10 Jun 2017 21:54:38 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 1e03b7118 -> 40509fd7b


KAFKA-4661: Improve test coverage UsePreviousTimeOnInvalidTimestamp

Author: Jeyhun Karimov <je.karimov@gmail.com>

Reviewers: Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>

Closes #3288 from jeyhunkarimov/KAFKA-4661


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/40509fd7
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/40509fd7
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/40509fd7

Branch: refs/heads/trunk
Commit: 40509fd7b60018f06bcb4c55deabc2503415fcb2
Parents: 1e03b71
Author: Jeyhun Karimov <je.karimov@gmail.com>
Authored: Sat Jun 10 14:54:35 2017 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Sat Jun 10 14:54:35 2017 -0700

----------------------------------------------------------------------
 .../processor/UsePreviousTimeOnInvalidTimestampTest.java | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/40509fd7/streams/src/test/java/org/apache/kafka/streams/processor/UsePreviousTimeOnInvalidTimestampTest.java
----------------------------------------------------------------------
diff --git a/streams/src/test/java/org/apache/kafka/streams/processor/UsePreviousTimeOnInvalidTimestampTest.java
b/streams/src/test/java/org/apache/kafka/streams/processor/UsePreviousTimeOnInvalidTimestampTest.java
index 4fe9fab..d46f3d7 100644
--- a/streams/src/test/java/org/apache/kafka/streams/processor/UsePreviousTimeOnInvalidTimestampTest.java
+++ b/streams/src/test/java/org/apache/kafka/streams/processor/UsePreviousTimeOnInvalidTimestampTest.java
@@ -17,10 +17,12 @@
 package org.apache.kafka.streams.processor;
 
 import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.streams.errors.StreamsException;
 import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
 
 public class UsePreviousTimeOnInvalidTimestampTest extends TimestampExtractorTest {
 
@@ -42,4 +44,13 @@ public class UsePreviousTimeOnInvalidTimestampTest extends TimestampExtractorTes
         assertThat(timestamp, is(previousTime));
     }
 
+    @Test
+    public void shouldThrowStreamsException() {
+        final TimestampExtractor extractor = new UsePreviousTimeOnInvalidTimestamp();
+        final ConsumerRecord record = new ConsumerRecord<>("anyTopic", 0, 0, null,
null);
+        try {
+            extractor.extract(record, -1);
+            fail("should have thrown StreamsException");
+        } catch (final StreamsException expected) { }
+    }
 }


Mime
View raw message