You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/06/03 07:57:43 UTC

incubator-kylin git commit: KYLIN-810, fix unit test MeasureCodecTest

Repository: incubator-kylin
Updated Branches:
  refs/heads/0.8.0 7398eb4ae -> 890ade2a4


KYLIN-810, fix unit test MeasureCodecTest


Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/890ade2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/890ade2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/890ade2a

Branch: refs/heads/0.8.0
Commit: 890ade2a468c28773686bfd24e3277c6b3827674
Parents: 7398eb4
Author: Li, Yang <ya...@ebay.com>
Authored: Wed Jun 3 13:57:14 2015 +0800
Committer: Li, Yang <ya...@ebay.com>
Committed: Wed Jun 3 13:57:14 2015 +0800

----------------------------------------------------------------------
 .../metadata/measure/MeasureCodecTest.java      | 25 ++++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/890ade2a/cube/src/test/java/org/apache/kylin/metadata/measure/MeasureCodecTest.java
----------------------------------------------------------------------
diff --git a/cube/src/test/java/org/apache/kylin/metadata/measure/MeasureCodecTest.java b/cube/src/test/java/org/apache/kylin/metadata/measure/MeasureCodecTest.java
index 7243289..80a1543 100644
--- a/cube/src/test/java/org/apache/kylin/metadata/measure/MeasureCodecTest.java
+++ b/cube/src/test/java/org/apache/kylin/metadata/measure/MeasureCodecTest.java
@@ -18,6 +18,11 @@
 
 package org.apache.kylin.metadata.measure;
 
+import static org.junit.Assert.*;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
 import org.apache.hadoop.io.DoubleWritable;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.kylin.common.hll.HyperLogLogPlusCounter;
@@ -26,21 +31,14 @@ import org.apache.kylin.metadata.model.FunctionDesc;
 import org.apache.kylin.metadata.model.MeasureDesc;
 import org.junit.Test;
 
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertTrue;
-
 /**
- * @author yangli9
  * 
  */
 public class MeasureCodecTest {
 
     @Test
     public void basicTest() {
-        MeasureDesc descs[] = new MeasureDesc[] { measure("double"), measure("long"), measure("decimal"), measure("HLLC16"), measure("HLLC16") };
+        MeasureDesc descs[] = new MeasureDesc[] { measure("double"), measure("long"), measure("decimal"), measure("HLLC16") };
         MeasureCodec codec = new MeasureCodec(descs);
 
         DoubleWritable d = new DoubleWritable(1.0);
@@ -49,10 +47,7 @@ public class MeasureCodecTest {
         HyperLogLogPlusCounter hllc = new HyperLogLogPlusCounter(16);
         hllc.add("1234567");
         hllc.add("abcdefg");
-        HyperLogLogPlusCounter hllc2 = new HyperLogLogPlusCounter(16);
-        hllc.add("1234567");
-        hllc.add("abcdefg");
-        Object values[] = new Object[] { d, l, b, hllc, hllc2 };
+        Object values[] = new Object[] { d, l, b, hllc };
 
         ByteBuffer buf = ByteBuffer.allocate(RowConstants.ROWVALUE_BUFFER_SIZE);
 
@@ -64,7 +59,11 @@ public class MeasureCodecTest {
 
         codec.decode(buf, copy);
 
-        assertTrue(Arrays.equals(values, copy));
+        for (int i = 0; i < values.length; i++) {
+            Object x = values[i];
+            Object y = copy[i];
+            assertEquals(x, y);
+        }
     }
 
     private MeasureDesc measure(String returnType) {