lttng: Port unit tests to JUnit4
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.core.tests / src / org / eclipse / linuxtools / lttng2 / core / tests / control / model / impl / TraceInfoTest.java
index e60169c11719d226b6791f3bd51514077f848800..48e60a1a6cf784feb105d46aac0e2312a7b75bf9 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 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
@@ -8,23 +8,29 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ITraceInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.TraceInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>TraceInfoTest</code> contains test for the class <code>{@link TraceInfo}</code>.
+ * The class <code>TraceInfoTest</code> contains test for the class
+ * <code>{@link TraceInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class TraceInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class TraceInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private ITraceInfo fTraceInfo1 = null;
     private ITraceInfo fTraceInfo2 = null;
 
@@ -32,36 +38,24 @@ public class TraceInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
+
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
+    @Before
+    public void setUp() {
         fTraceInfo1 = new TraceInfo("event1");
         fTraceInfo2 = new TraceInfo("event2");
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() throws Exception {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
 
     /**
      * Run the BaseEventInfo() constructor test.
-     *
      */
+    @Test
     public void testTraceInfo() {
         TraceInfo fixture = new TraceInfo("event");
         assertNotNull(fixture);
@@ -72,6 +66,7 @@ public class TraceInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testTraceInfo2() {
         try {
             String name = null;
@@ -86,6 +81,7 @@ public class TraceInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testTraceInfoCopy() {
         TraceInfo info = new TraceInfo((TraceInfo)fTraceInfo1);
 
@@ -95,6 +91,7 @@ public class TraceInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testTraceCopy2() {
         try {
             TraceInfo info = null;
@@ -108,8 +105,8 @@ public class TraceInfoTest extends TestCase {
 
     /**
      * Run the void setEventType(String) method test.
-     *
      */
+    @Test
     public void testSetName() {
         TraceInfo fixture = new TraceInfo("event");
         fixture.setName("newName");
@@ -118,8 +115,8 @@ public class TraceInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_1() {
         String result = fTraceInfo1.toString();
 
@@ -131,6 +128,10 @@ public class TraceInfoTest extends TestCase {
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fTraceInfo1.equals(fTraceInfo1));
         assertTrue("equals", fTraceInfo2.equals(fTraceInfo2));
@@ -139,6 +140,10 @@ public class TraceInfoTest extends TestCase {
         assertTrue("equals", !fTraceInfo2.equals(fTraceInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
         TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo2);
@@ -149,7 +154,10 @@ public class TraceInfoTest extends TestCase {
         assertTrue("equals", info2.equals(fTraceInfo2));
         assertTrue("equals", fTraceInfo2.equals(info2));
     }
-
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
         TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo1);
@@ -159,7 +167,10 @@ public class TraceInfoTest extends TestCase {
         assertTrue("equals", info2.equals(info3));
         assertTrue("equals", info1.equals(info3));
     }
-
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fTraceInfo1.equals(null));
         assertTrue("equals", !fTraceInfo2.equals(null));
@@ -169,6 +180,10 @@ public class TraceInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         TraceInfo info1 = new TraceInfo((TraceInfo)fTraceInfo1);
         TraceInfo info2 = new TraceInfo((TraceInfo)fTraceInfo2);
This page took 0.028864 seconds and 5 git commands to generate.