Remove the generic location (replace by Comparable)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / src / org / eclipse / linuxtools / tmf / core / tests / trace / TmfCheckpointTest.java
index 55e373b86f3e683a3b43ecb0757997b618eb02ae..bedaa6991bbf7a323e95fcf69b51c4b6605b1f01 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 2012 Ericsson
- * 
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *   Francois Chouinard - Adapted for TMF Trace Model 1.0
@@ -17,13 +17,15 @@ import junit.framework.TestCase;
 
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
 
 /**
  * Test suite for the TmfCheckpoint class.
  */
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls","javadoc"})
 public class TmfCheckpointTest extends TestCase {
 
     // ------------------------------------------------------------------------
@@ -37,13 +39,13 @@ public class TmfCheckpointTest extends TestCase {
     Long aLong1 = 12345L;
     Long aLong2 = 23456L;
     Long aLong3 = 34567L;
-    TmfLocation<Long> fLocation1 = new TmfLocation<Long>(aLong1);
-    TmfLocation<Long> fLocation2 = new TmfLocation<Long>(aLong2);
-    TmfLocation<Long> fLocation3 = new TmfLocation<Long>(aLong3);
+    ITmfLocation fLocation1 = new TmfLongLocation(aLong1);
+    ITmfLocation fLocation2 = new TmfLongLocation(aLong2);
+    ITmfLocation fLocation3 = new TmfLongLocation(aLong3);
 
-    TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
-    TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, fLocation2);
-    TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, fLocation3);
+    TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, new TmfContext(fLocation1));
+    TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, new TmfContext(fLocation2));
+    TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, new TmfContext(fLocation3));
 
     // ------------------------------------------------------------------------
     // Housekeeping
@@ -82,7 +84,7 @@ public class TmfCheckpointTest extends TestCase {
         assertEquals("TmfCheckpoint", fLocation1,  checkpoint.getLocation());
     }
 
-    public void testTmfLocationCopy2() throws Exception {
+    public void testTmfLocationCopy2() {
         try {
             new TmfCheckpoint(null);
             fail("null copy");
@@ -112,10 +114,10 @@ public class TmfCheckpointTest extends TestCase {
             checkpoint1 = new TmfCheckpoint(fTimestamp1, null);
             checkpoint2 = checkpoint1.clone();
             assertEquals("clone", checkpoint1, checkpoint2);
-            assertNull(checkpoint1.getLocation());
-            assertNull(checkpoint2.getLocation());
+            assertNull(checkpoint1.getContext());
+            assertNull(checkpoint2.getContext());
 
-            checkpoint1 = new TmfCheckpoint(null, fLocation1);
+            checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1));
             checkpoint3 = checkpoint1.clone();
             assertEquals("clone", checkpoint1, checkpoint3);
             assertNull(checkpoint1.getTimestamp());
@@ -145,10 +147,10 @@ public class TmfCheckpointTest extends TestCase {
     }
 
     public void testCompareToNull() {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, fLocation2);
-        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, fLocation3);
-        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, fLocation1);
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1));
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, new TmfContext(fLocation2));
+        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, new TmfContext(fLocation3));
+        final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, new TmfContext(fLocation1));
 
         // Test the various 'null' vs. '!null' combinations
         assertEquals("compareTo",  0, checkpoint1.compareTo(fCheckpoint1));
@@ -171,7 +173,7 @@ public class TmfCheckpointTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
-    public void testHashCode() throws Exception {
+    public void testHashCode() {
         final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
         final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
 
@@ -182,8 +184,8 @@ public class TmfCheckpointTest extends TestCase {
         assertTrue("hashCode", fCheckpoint2.hashCode() != checkpoint1.hashCode());
     }
 
-    public void testHashCodeNull() throws Exception {
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
+    public void testHashCodeNull() {
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, new TmfContext(fLocation1));
         final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp1, null);
         final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint1);
         final TmfCheckpoint checkpoint4 = new TmfCheckpoint(checkpoint2);
@@ -199,7 +201,7 @@ public class TmfCheckpointTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
-    public void testEqualsReflexivity() throws Exception {
+    public void testEqualsReflexivity() {
         assertTrue("equals", fCheckpoint1.equals(fCheckpoint1));
         assertTrue("equals", fCheckpoint2.equals(fCheckpoint2));
 
@@ -207,7 +209,7 @@ public class TmfCheckpointTest extends TestCase {
         assertTrue("equals", !fCheckpoint2.equals(fCheckpoint1));
     }
 
-    public void testEqualsSymmetry() throws Exception {
+    public void testEqualsSymmetry() {
         final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
         final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
 
@@ -218,7 +220,7 @@ public class TmfCheckpointTest extends TestCase {
         assertTrue("equals", fCheckpoint2.equals(checkpoint2));
     }
 
-    public void testEqualsTransivity() throws Exception {
+    public void testEqualsTransivity() {
         final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
         final TmfCheckpoint checkpoint2 = new TmfCheckpoint(checkpoint1);
         final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint2);
@@ -228,13 +230,13 @@ public class TmfCheckpointTest extends TestCase {
         assertTrue("equals", checkpoint1.equals(checkpoint3));
     }
 
-    public void testNotEqual() throws Exception {
+    public void testNotEqual() {
         // Various checkpoints
-        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
-        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, fLocation1);
-        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, fLocation2);
+        final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, new TmfContext(fLocation1));
+        final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, new TmfContext(fLocation1));
+        final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, new TmfContext(fLocation2));
         final TmfCheckpoint checkpoint4 = new TmfCheckpoint(fTimestamp1, null);
-        final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, fLocation1);
+        final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, new TmfContext(fLocation1));
 
         // Null check
         assertFalse("equals", checkpoint1.equals(null));
@@ -258,11 +260,11 @@ public class TmfCheckpointTest extends TestCase {
     // ------------------------------------------------------------------------
 
     public void testToString() {
-        final String expected1 = "TmfCheckpoint [fLocation=" + fCheckpoint1.getLocation() +
+        final String expected1 = "TmfCheckpoint [fContext=" + fCheckpoint1.getContext() +
                 ", fTimestamp=" + fCheckpoint1.getTimestamp() + "]";
-        final String expected2 = "TmfCheckpoint [fLocation=" + fCheckpoint2.getLocation() +
+        final String expected2 = "TmfCheckpoint [fContext=" + fCheckpoint2.getContext() +
                 ", fTimestamp=" + fCheckpoint2.getTimestamp() + "]";
-        final String expected3 = "TmfCheckpoint [fLocation=" + fCheckpoint3.getLocation() +
+        final String expected3 = "TmfCheckpoint [fContext=" + fCheckpoint3.getContext() +
                 ", fTimestamp=" + fCheckpoint3.getTimestamp() + "]";
 
         assertEquals("toString", expected1, fCheckpoint1.toString());
This page took 0.026627 seconds and 5 git commands to generate.