ctf: Clean up unit tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / trace / MetadataTest.java
index 077ad141d23f39f01ed2c361985baddad034e5ff..87b97025356eadc4c9cea2f44f6b23dbbbdd7ce9 100644 (file)
@@ -1,52 +1,51 @@
+/*******************************************************************************
+ * 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.trace;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assume.assumeTrue;
 
 import java.nio.ByteOrder;
 
-import org.eclipse.linuxtools.ctf.core.tests.TestParams;
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.Metadata;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
  * The class <code>MetadataTest</code> contains tests for the class
  * <code>{@link Metadata}</code>.
- * 
+ *
  * @author ematkho
  * @version $Revision: 1.0 $
  */
+@SuppressWarnings("javadoc")
 public class MetadataTest {
 
-    private Metadata fixture;
+    private static final int TRACE_INDEX = 0;
 
-    /**
-     * Launch the test.
-     * 
-     * @param args
-     *            the command line arguments
-     */
-    public static void main(String[] args) {
-        new org.junit.runner.JUnitCore().run(MetadataTest.class);
-    }
+    private Metadata fixture;
 
     /**
      * Perform pre-test initialization.
+     *
+     * @throws CTFReaderException
      */
     @Before
-    public void setUp() {
-        fixture = new Metadata(TestParams.createTrace());
-    }
-
-    /**
-     * Perform post-test clean-up.
-     */
-    @After
-    public void tearDown() {
-        // Add additional tear down code here
+    public void setUp() throws CTFReaderException {
+        assumeTrue(CtfTestTraces.tracesExist());
+        fixture = new Metadata(CtfTestTraces.getTestTrace(TRACE_INDEX));
     }
 
     /**
@@ -66,9 +65,18 @@ public class MetadataTest {
         assertNull(result);
     }
 
+    /**
+     * Test toString
+     */
+    @Test
+    public void testToSting() {
+        String result = fixture.toString();
+        assertNotNull(result);
+    }
+
     /**
      * Run the void parse() method test.
-     * 
+     *
      * @throws CTFReaderException
      */
     @Test(expected = org.eclipse.linuxtools.ctf.core.trace.CTFReaderException.class)
This page took 0.025489 seconds and 5 git commands to generate.