ctf: Fix API inconsistencies
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / trace / StreamInputReaderTest.java
index f10138f57665c186b7fc59f00a7e11129121271a..5e850b77dc62c8682a59a90940c9084d9ce5baef 100644 (file)
@@ -13,9 +13,9 @@ import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.tests.TestParams;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
+import org.eclipse.linuxtools.ctf.core.trace.Stream;
+import org.eclipse.linuxtools.ctf.core.trace.StreamInput;
 import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
-import org.eclipse.linuxtools.internal.ctf.core.trace.Stream;
-import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInput;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -27,6 +27,7 @@ import org.junit.Test;
  * @author ematkho
  * @version $Revision: 1.0 $
  */
+@SuppressWarnings("javadoc")
 public class StreamInputReaderTest {
 
     private StreamInputReader fixture;
@@ -142,12 +143,30 @@ public class StreamInputReaderTest {
 
     /**
      * Run the void goToLastEvent() method test.
-     *
-     * @throws CTFReaderException
      */
     @Test
-    public void testGoToLastEvent() throws CTFReaderException {
+    public void testGoToLastEvent1() {
+        final long endTimestamp = goToEnd();
+        final long endTime = 4287422460315L;
+        assertEquals(endTime , endTimestamp  );
+    }
+
+    /**
+     * Run the void goToLastEvent() method test.
+     */
+    @Test
+    public void testGoToLastEvent2() {
+        long timestamp = -1;
+        while(fixture.readNextEvent()) {
+            timestamp = fixture.getCurrentEvent().getTimestamp();
+        }
+        long endTimestamp = goToEnd();
+        assertEquals(0 , timestamp- endTimestamp );
+    }
+
+    private long goToEnd() {
         fixture.goToLastEvent();
+        return fixture.getCurrentEvent().getTimestamp();
     }
 
     /**
@@ -178,7 +197,7 @@ public class StreamInputReaderTest {
     public void testSeek_eventDefinition() throws CTFReaderException {
         EventDefinition eventDefinition = new EventDefinition(
                 new EventDeclaration(), getStreamInputReader());
-        eventDefinition.timestamp = 1L;
+        eventDefinition.setTimestamp(1L);
         fixture.setCurrentEvent(eventDefinition);
     }
 }
\ No newline at end of file
This page took 0.026248 seconds and 5 git commands to generate.