ctf: Clean up unit tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / types / SequenceDefinitionTest.java
index 11745a81f1ec0403824928fe0bd7852b05c18ec4..8f875f5ca1a67fad1f959b2f2b44c4105b64c22e 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ *     Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.ctf.core.tests.types;
 
 import static org.junit.Assert.assertEquals;
@@ -6,6 +17,7 @@ import static org.junit.Assert.assertTrue;
 
 import java.nio.ByteOrder;
 
+import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
 import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
@@ -14,8 +26,6 @@ import org.eclipse.linuxtools.ctf.core.event.types.SequenceDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -26,24 +36,15 @@ import org.junit.Test;
  * @author ematkho
  * @version $Revision: 1.0 $
  */
+@SuppressWarnings("javadoc")
 public class SequenceDefinitionTest {
 
     private SequenceDefinition fixture;
     private final static int seqLen = 15;
 
-    /**
-     * Launch the test.
-     *
-     * @param args
-     *            the command line arguments
-     */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(SequenceDefinitionTest.class);
-    }
-
     /**
      * Perform pre-test initialization.
-     * @throws CTFReaderException 
+     * @throws CTFReaderException
      */
     @Before
     public void setUp() throws CTFReaderException {
@@ -51,15 +52,15 @@ public class SequenceDefinitionTest {
         StructDefinition structDef;
 
         IntegerDeclaration id = new IntegerDeclaration(8, false, 8,
-                ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null);
-        String lengthName = "LengthName"; //$NON-NLS-1$
+                ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null, 8);
+        String lengthName = "LengthName";
         structDec = new StructDeclaration(0);
         structDec.addField(lengthName, id);
-        structDef = new StructDefinition(structDec, null, "x"); //$NON-NLS-1$
+        structDef = new StructDefinition(structDec, null, "x");
 
         structDef.lookupInteger(lengthName).setValue(seqLen);
         SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
-        fixture = new SequenceDefinition(sd, structDef, "TestX"); //$NON-NLS-1$
+        fixture = new SequenceDefinition(sd, structDef, "TestX");
         BitBuffer input = new BitBuffer(
                 java.nio.ByteBuffer.allocateDirect(seqLen * 8));
         for (int i = 0; i < seqLen; i++) {
@@ -69,29 +70,21 @@ public class SequenceDefinitionTest {
         assert (fixture != null);
     }
 
-    /**
-     * Perform post-test clean-up.
-     */
-    @After
-    public void tearDown() {
-        // Add additional tear down code here
-    }
-
     private static SequenceDefinition initNonString() throws CTFReaderException {
         StructDeclaration structDec;
         StructDefinition structDef;
 
         int len = 32;
         IntegerDeclaration id = new IntegerDeclaration(len, false, len,
-                ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null);
-        String lengthName = "LengthName"; //$NON-NLS-1$
+                ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null,8);
+        String lengthName = "LengthName";
         structDec = new StructDeclaration(0);
         structDec.addField(lengthName, id);
-        structDef = new StructDefinition(structDec, null, "x"); //$NON-NLS-1$
+        structDef = new StructDefinition(structDec, null, "x");
 
         structDef.lookupInteger(lengthName).setValue(seqLen);
         SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
-        SequenceDefinition ret = new SequenceDefinition(sd, structDef, "TestX"); //$NON-NLS-1$
+        SequenceDefinition ret = new SequenceDefinition(sd, structDef, "TestX");
         BitBuffer input = new BitBuffer(
                 java.nio.ByteBuffer.allocateDirect(seqLen * len));
         for (int i = 0; i < seqLen; i++) {
@@ -172,8 +165,8 @@ public class SequenceDefinitionTest {
      */
     @Test
     public void testToString_nonString() throws Exception {
-        SequenceDefinition nonStringFixture = initNonString();
-        String result = nonStringFixture.toString();
+        fixture = initNonString();
+        String result = fixture.toString();
         assertNotNull(result);
     }
 }
This page took 0.026316 seconds and 5 git commands to generate.