cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: use junit assertions for unit tests over java asserts
Date Fri, 25 Oct 2013 04:41:31 GMT
Updated Branches:
  refs/heads/trunk 8fbdc9f82 -> 2faac19e1


use junit assertions for unit tests over java asserts


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

Branch: refs/heads/trunk
Commit: 2faac19e1746d179c04596cb6885d1cb52663e77
Parents: 8fbdc9f
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Fri Oct 25 00:41:09 2013 -0400
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Fri Oct 25 00:41:09 2013 -0400

----------------------------------------------------------------------
 .../config/DatabaseDescriptorTest.java          | 29 +++++++++-----------
 1 file changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2faac19e/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java b/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
index 7d1c82b..b954f39 100644
--- a/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
+++ b/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
@@ -31,14 +31,11 @@ import org.junit.runner.RunWith;
 
 import static org.junit.Assert.*;
 
-
-import java.io.IOException;
-
 @RunWith(OrderedJUnit4ClassRunner.class)
 public class DatabaseDescriptorTest
 {
     @Test
-    public void testCFMetaDataSerialization() throws IOException, ConfigurationException,
InvalidRequestException
+    public void testCFMetaDataSerialization() throws ConfigurationException, InvalidRequestException
     {
         // test serialization of all defined test CFs.
         for (String keyspaceName : Schema.instance.getNonSystemKeyspaces())
@@ -46,21 +43,21 @@ public class DatabaseDescriptorTest
             for (CFMetaData cfm : Schema.instance.getKeyspaceMetaData(keyspaceName).values())
             {
                 CFMetaData cfmDupe = CFMetaData.fromThrift(cfm.toThrift());
-                assert cfmDupe != null;
-                assert cfmDupe.equals(cfm);
+                assertNotNull(cfmDupe);
+                assertEquals(cfm, cfmDupe);
             }
         }
     }
 
     @Test
-    public void testKSMetaDataSerialization() throws IOException, ConfigurationException
+    public void testKSMetaDataSerialization() throws ConfigurationException
     {
         for (KSMetaData ksm : Schema.instance.getKeyspaceDefinitions())
         {
             // Not testing round-trip on the KsDef via serDe() because maps
             KSMetaData ksmDupe = KSMetaData.fromThrift(ksm.toThrift());
-            assert ksmDupe != null;
-            assert ksmDupe.equals(ksm);
+            assertNotNull(ksmDupe);
+            assertEquals(ksm, ksmDupe);
         }
     }
 
@@ -70,7 +67,7 @@ public class DatabaseDescriptorTest
     {
         SchemaLoader.cleanupAndLeaveDirs();
         DatabaseDescriptor.loadSchemas();
-        assert Schema.instance.getNonSystemKeyspaces().size() == 0;
+        assertEquals(0, Schema.instance.getNonSystemKeyspaces().size());
 
         Gossiper.instance.start((int)(System.currentTimeMillis() / 1000));
 
@@ -80,19 +77,19 @@ public class DatabaseDescriptorTest
             MigrationManager.announceNewKeyspace(KSMetaData.testMetadata("ks0", SimpleStrategy.class,
KSMetaData.optsWithRF(3)));
             MigrationManager.announceNewKeyspace(KSMetaData.testMetadata("ks1", SimpleStrategy.class,
KSMetaData.optsWithRF(3)));
 
-            assert Schema.instance.getKSMetaData("ks0") != null;
-            assert Schema.instance.getKSMetaData("ks1") != null;
+            assertNotNull(Schema.instance.getKSMetaData("ks0"));
+            assertNotNull(Schema.instance.getKSMetaData("ks1"));
 
             Schema.instance.clearKeyspaceDefinition(Schema.instance.getKSMetaData("ks0"));
             Schema.instance.clearKeyspaceDefinition(Schema.instance.getKSMetaData("ks1"));
 
-            assert Schema.instance.getKSMetaData("ks0") == null;
-            assert Schema.instance.getKSMetaData("ks1") == null;
+            assertNull(Schema.instance.getKSMetaData("ks0"));
+            assertNull(Schema.instance.getKSMetaData("ks1"));
 
             DatabaseDescriptor.loadSchemas();
 
-            assert Schema.instance.getKSMetaData("ks0") != null;
-            assert Schema.instance.getKSMetaData("ks1") != null;
+            assertNotNull(Schema.instance.getKSMetaData("ks0"));
+            assertNotNull(Schema.instance.getKSMetaData("ks1"));
         }
         finally
         {


Mime
View raw message