cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r960289 - /cassandra/trunk/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java
Date Sun, 04 Jul 2010 02:48:17 GMT
Author: jbellis
Date: Sun Jul  4 02:48:17 2010
New Revision: 960289

URL: http://svn.apache.org/viewvc?rev=960289&view=rev
Log:
belatedly add ColumnDefinitionTest, part of the CASSANDRA-1153 patch

Added:
    cassandra/trunk/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java

Added: cassandra/trunk/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java?rev=960289&view=auto
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java (added)
+++ cassandra/trunk/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java Sun Jul
 4 02:48:17 2010
@@ -0,0 +1,33 @@
+package org.apache.cassandra.config;
+
+import org.junit.Test;
+
+public class ColumnDefinitionTest
+{
+    @Test
+    public void testSerializeDeserialize() throws Exception
+    {
+        ColumnDefinition cd0 = new ColumnDefinition(
+                "TestColumnDefinitionName0".getBytes("UTF8"),
+                "org.apache.cassandra.config.RandomClass0",
+                "random index name 0",
+                "random index type 0");
+
+        ColumnDefinition cd1 = new ColumnDefinition(
+                "TestColumnDefinition1".getBytes("UTF8"),
+                "org.apache.cassandra.config.RandomClass1",
+                null,
+                null);
+
+        testSerializeDeserialize(cd0);
+        testSerializeDeserialize(cd1);
+    }
+
+    protected void testSerializeDeserialize(ColumnDefinition cd) throws Exception
+    {
+        ColumnDefinition newCd = ColumnDefinition.deserialize(ColumnDefinition.serialize(cd));
+        assert cd != newCd;
+        assert cd.hashCode() == newCd.hashCode();
+        assert cd.equals(newCd);
+    }
+}



Mime
View raw message