ctf: Throw CTFReaderException in the BitBuffer API
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / src / org / eclipse / linuxtools / tmf / core / tests / ctfadaptor / CtfTmfEventFieldTest.java
index aff0160355434ed9287dfb8735096f87018e7684..42414bcfb6b93915fa747a1314942d4af3e80c32 100644 (file)
@@ -14,6 +14,7 @@
 package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertArrayEquals;
 
 import java.nio.ByteOrder;
 
@@ -30,6 +31,7 @@ import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventField;
 import org.junit.Before;
 import org.junit.Test;
@@ -59,9 +61,10 @@ public class CtfTmfEventFieldTest {
 
     /**
      * Perform pre-test initialization.
+     * @throws CTFReaderException error
      */
     @Before
-    public void setUp() {
+    public void setUp() throws CTFReaderException {
         StructDeclaration sDec = new StructDeclaration(1l);
         StringDeclaration strDec = new StringDeclaration();
         IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
@@ -79,12 +82,12 @@ public class CtfTmfEventFieldTest {
         sDec.addField(STR, strDec);
         sDec.addField(ARRAY, arrDec);
         sDec.addField(SEQ, seqDec);
-        structDec.addField(STR,strDec);
+        structDec.addField(STR, strDec);
         structDec.addField(INT, intDec);
         sDec.addField(STRUCT, structDec);
         enumDec.add(0, 1, LEN);
         enumDec.add(2, 3, FLOAT);
-        sDec.addField(ENUM,  enumDec);
+        sDec.addField(ENUM, enumDec);
         varDec.addField(LEN, intDec);
         varDec.addField(FLOAT, flDec);
         varDec.setTag(ENUM);
@@ -152,7 +155,9 @@ public class CtfTmfEventFieldTest {
     public void testParseField_sequence_value() {
         Definition fieldDef = fixture.lookupDefinition(SEQ);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("[2, 2]", result.getValue().toString());
+        long[] values = (long[]) result.getValue();
+        long[] expected = new long[] { 2, 2 };
+        assertArrayEquals(expected, values);
     }
 
     /**
@@ -192,6 +197,6 @@ public class CtfTmfEventFieldTest {
     public void testParseField_variant() {
         Definition fieldDef = fixture.lookupDefinition(VARIANT);
         CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("float=9.551467814359616E-38", result.toString());
+        assertEquals("test=float=9.551467814359616E-38", result.toString());
     }
 }
This page took 0.02847 seconds and 5 git commands to generate.