Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 029DC200CA5 for ; Sat, 10 Jun 2017 23:54:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 004D9160BDA; Sat, 10 Jun 2017 21:54:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 470FD160BC8 for ; Sat, 10 Jun 2017 23:54:40 +0200 (CEST) Received: (qmail 73793 invoked by uid 500); 10 Jun 2017 21:54:39 -0000 Mailing-List: contact commits-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list commits@kafka.apache.org Received: (qmail 73773 invoked by uid 99); 10 Jun 2017 21:54:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Jun 2017 21:54:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 16D10DFF16; Sat, 10 Jun 2017 21:54:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: guozhang@apache.org To: commits@kafka.apache.org Message-Id: <233686f772bf417fa119964c10ea4765@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: kafka git commit: KAFKA-4661: Improve test coverage UsePreviousTimeOnInvalidTimestamp Date: Sat, 10 Jun 2017 21:54:38 +0000 (UTC) archived-at: Sat, 10 Jun 2017 21:54:41 -0000 Repository: kafka Updated Branches: refs/heads/trunk 1e03b7118 -> 40509fd7b KAFKA-4661: Improve test coverage UsePreviousTimeOnInvalidTimestamp Author: Jeyhun Karimov Reviewers: Matthias J. Sax , Guozhang Wang 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 Authored: Sat Jun 10 14:54:35 2017 -0700 Committer: Guozhang Wang 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) { } + } }