ctf: Fix lost events in a more elegant way
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / src / org / eclipse / linuxtools / tmf / core / tests / ctfadaptor / CtfLocationTest.java
index 6f337cb81b394395f3057f0f35c2ced514512ade..087c22fd8b101ddb907b1191be157a00c21b123f 100644 (file)
@@ -17,6 +17,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationData;
 import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
 import org.junit.After;
@@ -49,8 +50,8 @@ public class CtfLocationTest {
      */
     @Before
     public void setUp() {
-        fixture = new CtfLocation(Long.valueOf(1));
-        fixture.setLocation(Long.valueOf(1));
+        fixture = new CtfLocation(new CtfLocationData(1, 0));
+        fixture.setLocation(new CtfLocationData(1, 0));
     }
 
     /**
@@ -67,11 +68,11 @@ public class CtfLocationTest {
      */
     @Test
     public void testCtfLocation_long() {
-        Long location = Long.valueOf(1);
+        CtfLocationData location = new CtfLocationData(1, 0);
         CtfLocation result = new CtfLocation(location);
 
         assertNotNull(result);
-        assertEquals(Long.valueOf(1), result.getLocation());
+        assertEquals(Long.valueOf(1), (Long)result.getLocation().getTimestamp());
     }
 
     /**
@@ -83,7 +84,7 @@ public class CtfLocationTest {
         CtfLocation result = new CtfLocation(timestamp);
 
         assertNotNull(result);
-        assertEquals(new Long(0L), result.getLocation());
+        assertEquals(new Long(0L), (Long)result.getLocation().getTimestamp());
     }
 
     /**
@@ -94,7 +95,7 @@ public class CtfLocationTest {
         CtfLocation result = fixture.clone();
 
         assertNotNull(result);
-        assertEquals(Long.valueOf(1), result.getLocation());
+        assertEquals(Long.valueOf(1), (Long)result.getLocation().getTimestamp());
     }
 
     /**
@@ -102,8 +103,8 @@ public class CtfLocationTest {
      */
     @Test
     public void testGetLocation() {
-        Long result = fixture.getLocation();
-
+        CtfLocationData location = fixture.getLocation();
+        Long result = location.getTimestamp();
         assertNotNull(result);
         assertEquals("1", result.toString()); //$NON-NLS-1$
         assertEquals((byte) 1, result.byteValue());
@@ -119,7 +120,7 @@ public class CtfLocationTest {
      */
     @Test
     public void testSetLocation() {
-        Long location = Long.valueOf(1);
+        CtfLocationData location = new CtfLocationData(1337, 7331);
         fixture.setLocation(location);
     }
 
@@ -128,8 +129,8 @@ public class CtfLocationTest {
      */
     @Test
     public void testToString_valid(){
-        CtfLocation fixture2 = new CtfLocation(new Long(1337L));
-        assertEquals("CtfLocation: 1337",fixture2.toString()); //$NON-NLS-1$
+        CtfLocation fixture2 = new CtfLocation(new CtfLocationData(1337, 7331));
+        assertEquals("CtfLocation: Element [1337/7331]",fixture2.toString()); //$NON-NLS-1$
     }
 
     /**
@@ -137,7 +138,7 @@ public class CtfLocationTest {
      */
     @Test
     public void testToString_invalid(){
-        CtfLocation fixture2 = new CtfLocation(new Long(-1L));
+        CtfLocation fixture2 = new CtfLocation(new CtfLocationData(-1, -1));
         assertEquals("CtfLocation: INVALID",fixture2.toString()); //$NON-NLS-1$
     }
 }
This page took 0.037985 seconds and 5 git commands to generate.