ctf: Disable NLS warnings in test plugin
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / event / CTFEventFieldTest.java
index 1ff12815e083856a3910330d6c533ab8eeab67ec..66e7d5a95240ae33ed0b70c126d295936891e260 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.event;
 
 import static org.junit.Assert.assertEquals;
@@ -27,16 +38,16 @@ import org.junit.Test;
 /**
  * The class <code>CTFEventFieldTest</code> contains tests for the class
  * <code>{@link CTFEventField}</code>.
- * 
+ *
  * @author ematkho
  * @version $Revision: 1.0 $
- * @param <CTFIntegerArrayField>
  */
+@SuppressWarnings("javadoc")
 public class CTFEventFieldTest {
-    
-    private static final String fieldName = "id"; //$NON-NLS-1$
-    
-    
+
+    private static final String fieldName = "id";
+
+
     /**
      * Perform pre-test initialization.
      */
@@ -55,7 +66,7 @@ public class CTFEventFieldTest {
 
     /**
      * Launch the test.
-     * 
+     *
      * @param args
      *            the command line arguments
      */
@@ -65,14 +76,14 @@ public class CTFEventFieldTest {
 
     /**
      * Run the CTFEventField parseField(Definition,String) method test.
-     * @throws CTFReaderException 
+     * @throws CTFReaderException
      */
     @Test
     public void testParseField_complex() throws CTFReaderException {
         int len = 32;
         IntegerDeclaration id = new IntegerDeclaration(len, false, len,
-                ByteOrder.LITTLE_ENDIAN, Encoding.ASCII);
-        String lengthName = "LengthName"; //$NON-NLS-1$
+                ByteOrder.LITTLE_ENDIAN, Encoding.ASCII, null, 32);
+        String lengthName = "LengthName";
         StructDeclaration structDec = new StructDeclaration(0);
         structDec.addField(lengthName, id);
         StructDefinition structDef = new StructDefinition(structDec, null,
@@ -80,7 +91,7 @@ public class CTFEventFieldTest {
 
         structDef.lookupInteger(lengthName).setValue(32);
         SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
-        Definition fieldDef = new SequenceDefinition(sd, structDef, "TestX"); //$NON-NLS-1$
+        Definition fieldDef = new SequenceDefinition(sd, structDef, "TestX");
         ByteBuffer byb = ByteBuffer.allocate(1024);
         for (int i = 0; i < 1024; i++) {
             byb.put((byte) i);
@@ -93,16 +104,16 @@ public class CTFEventFieldTest {
 
     /**
      * Run the CTFEventField parseField(Definition,String) method test.
-     * @throws CTFReaderException 
+     * @throws CTFReaderException
      */
     @Test
-    public void testParseField_simple() throws CTFReaderException {
-        Definition fieldDef = new SequenceDefinition(new SequenceDeclaration(
-                "", new StringDeclaration()), null, fieldName); //$NON-NLS-1$
+    public void testParseField_simple() {
+        final StringDeclaration elemType = new StringDeclaration();
+        Definition fieldDef = elemType.createDefinition(null, fieldName);
 
         assertNotNull(fieldDef);
     }
-    
+
     /**
      * Run the CTFEventField parseField(Definition,String) method test.
      */
@@ -110,22 +121,22 @@ public class CTFEventFieldTest {
     public void testParseField_simple2() {
         IntegerDefinition fieldDef = new IntegerDefinition(
                 new IntegerDeclaration(1, true, 1, ByteOrder.BIG_ENDIAN,
-                        Encoding.ASCII), null, fieldName);
+                        Encoding.ASCII, null, 8), null, fieldName);
         fieldDef.setValue(1L);
 
         assertNotNull(fieldDef);
     }
-    
+
     /**
-     * 
+     *
      */
     @Test
     public void testParseField_simple3() {
         StringDefinition fieldDef = new StringDefinition(
                 new StringDeclaration(), null, fieldName);
-        fieldDef.setString(new StringBuilder("Hello World")); //$NON-NLS-1$
+        fieldDef.setString(new StringBuilder("Hello World"));
 
-        String other = fieldName + "=Hello World"; //$NON-NLS-1$
+        String other = "\"Hello World\"";
         assertNotNull(fieldDef);
         assertEquals(fieldDef.toString(), other);
     }
@@ -136,7 +147,7 @@ public class CTFEventFieldTest {
     @Test
     public void testParseField_manual() {
         Definition fieldDef = new ArrayDefinition(new ArrayDeclaration(20,
-                new IntegerDeclaration(8, false, 8, null, Encoding.UTF8)),
+                new IntegerDeclaration(8, false, 8, null, Encoding.UTF8, null, 8)),
                 null, fieldName);
         ((IntegerDefinition) ((ArrayDefinition) fieldDef).getDefinitions()[0]).setValue('H');
         ((IntegerDefinition) ((ArrayDefinition) fieldDef).getDefinitions()[1]).setValue('e');
@@ -160,7 +171,7 @@ public class CTFEventFieldTest {
     @Test
     public void testParseField_manual2() {
         Definition fieldDef = new ArrayDefinition(new ArrayDeclaration(12,
-                new IntegerDeclaration(32, false, 32, null, null)), null,
+                new IntegerDeclaration(32, false, 32, null, null, null, 8)), null,
                 fieldName);
         ((IntegerDefinition) ((ArrayDefinition) fieldDef).getDefinitions()[0]).setValue('H');
         ((IntegerDefinition) ((ArrayDefinition) fieldDef).getDefinitions()[1]).setValue('e');
@@ -176,8 +187,7 @@ public class CTFEventFieldTest {
         ((IntegerDefinition) ((ArrayDefinition) fieldDef).getDefinitions()[11]).setValue(0);
 
         assertNotNull(fieldDef);
-        String other = fieldName
-                + "={ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0}"; //$NON-NLS-1$
+        String other = "[ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0 ]";
         assertEquals(other, fieldDef.toString());
     }
 }
\ No newline at end of file
This page took 0.025629 seconds and 5 git commands to generate.