kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: HOTFIX: Add missing file for KeyValue unit test
Date Tue, 23 Feb 2016 23:33:35 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 0ce916398 -> c00a036e0


HOTFIX: Add missing file for KeyValue unit test

Author: Guozhang Wang <wangguoz@gmail.com>

Reviewers: Gwen Shapira

Closes #960 from guozhangwang/KCountP1


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

Branch: refs/heads/trunk
Commit: c00a036e068ea5b33363992abc0499affa7ca2d7
Parents: 0ce9163
Author: Guozhang Wang <wangguoz@gmail.com>
Authored: Tue Feb 23 15:33:29 2016 -0800
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Tue Feb 23 15:33:29 2016 -0800

----------------------------------------------------------------------
 .../org/apache/kafka/streams/KeyValueTest.java  | 50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/c00a036e/streams/src/test/java/org/apache/kafka/streams/KeyValueTest.java
----------------------------------------------------------------------
diff --git a/streams/src/test/java/org/apache/kafka/streams/KeyValueTest.java b/streams/src/test/java/org/apache/kafka/streams/KeyValueTest.java
new file mode 100644
index 0000000..47c8ecd
--- /dev/null
+++ b/streams/src/test/java/org/apache/kafka/streams/KeyValueTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class KeyValueTest {
+
+    private KeyValue<String, Long> kv1a = new KeyValue<>("key1", 1L);
+    private KeyValue<String, Long> kv1b = new KeyValue<>("key1", 1L);
+    private KeyValue<String, Long> kv2 = new KeyValue<>("key2", 2L);
+    private KeyValue<String, Long> kv3 = new KeyValue<>("key3", 3L);
+
+    @Test
+    public void testEquals() {
+        assertTrue(kv1a.equals(kv1a));
+        assertTrue(kv1a.equals(kv1b));
+        assertTrue(kv1b.equals(kv1a));
+        assertFalse(kv1a.equals(kv2));
+        assertFalse(kv1a.equals(kv3));
+        assertFalse(kv2.equals(kv3));
+        assertFalse(kv1a.equals(null));
+    }
+
+    @Test
+    public void testHashcode() {
+        assertTrue(kv1a.hashCode() == kv1b.hashCode());
+        assertFalse(kv1a.hashCode() == kv2.hashCode());
+        assertFalse(kv1a.hashCode() == kv3.hashCode());
+        assertFalse(kv2.hashCode() == kv3.hashCode());
+    }
+}


Mime
View raw message