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 / UstProviderInfoTest.java
index de0facfaf2bc32f148c81811544f163948b9d1c2..a95e3ab9aa4e3bda426d013f12ed99d45537a6d4 100644 (file)
@@ -8,28 +8,34 @@
  *
  * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Alexandre Montplaisir - Port to JUnit4
  **********************************************************************/
+
 package org.eclipse.linuxtools.lttng2.core.tests.control.model.impl;
 
+import static org.junit.Assert.*;
+
 import java.util.LinkedList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>ChannelInfoTest</code> contains tests for the class <code>{@link UstProviderInfo}</code>.
- *
+ * The class <code>ChannelInfoTest</code> contains tests for the class
+ * <code>{@link UstProviderInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class UstProviderInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class UstProviderInfoTest {
+
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IUstProviderInfo fUstProviderInfo1 = null;
     private IUstProviderInfo fUstProviderInfo2 = null;
 
@@ -42,12 +48,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception
-     *         if the initialization fails for some reason
-     *
      */
-    @Override
+    @Before
     public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fUstProviderInfo1 = factory.getUstProviderInfo1();
@@ -56,17 +58,6 @@ public class UstProviderInfoTest extends TestCase {
         fEventInfo2 = factory.getBaseEventInfo2();
     }
 
-    /**
-     * Perform post-test clean-up.
-     *
-     * @throws Exception
-     *         if the clean-up fails for some reason
-     *
-     */
-    @Override
-    public void tearDown() {
-    }
-
     // ------------------------------------------------------------------------
     // Tests
     // ------------------------------------------------------------------------
@@ -77,8 +68,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the UstProviderInfo() constructor test.
-     *
      */
+    @Test
     public void testUstProviderInfo() {
         IUstProviderInfo result = new UstProviderInfo("test");
         assertNotNull(result);
@@ -88,6 +79,10 @@ public class UstProviderInfoTest extends TestCase {
         assertEquals(0, result.getEvents().length);
     }
 
+    /**
+     * Test the copy constructor.
+     */
+    @Test
     public void testUstProviderInfoCopy() {
         IUstProviderInfo providerInf = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
 
@@ -102,6 +97,10 @@ public class UstProviderInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Test the copy constructor.
+     */
+    @Test
     public void testUstProviderCopy2() {
         try {
             UstProviderInfo providerInfo = null;
@@ -115,8 +114,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the IEventInfo[] getEvents() method test.
-     *
      */
+    @Test
     public void testGetAndSetters() {
         IUstProviderInfo fixture = new UstProviderInfo("test");
         fixture.setPid(2468);
@@ -138,8 +137,8 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the void setEvents(List<IBaseEventInfo>) method test.
-     *
      */
+    @Test
     public void testSetEvents_1() {
         UstProviderInfo fixture = new UstProviderInfo("test");
         fixture.setPid(2468);
@@ -157,6 +156,10 @@ public class UstProviderInfoTest extends TestCase {
         }
     }
 
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
     public void testToString_1() {
         UstProviderInfo fixture = new UstProviderInfo("test");
         fixture.setPid(2468);
@@ -167,20 +170,24 @@ public class UstProviderInfoTest extends TestCase {
 
     /**
      * Run the String toString() method test.
-     *
      */
+    @Test
     public void testToString_2() {
         String result = fUstProviderInfo2.toString();
         assertEquals("[EventInfo([TraceInfo(Name=myUST2)],PID=2345,Events=[BaseEventInfo([TraceInfo(Name=event1)]," +
-                       "type=UNKNOWN,level=TRACE_DEBUG,Fields=[FieldInfo([TraceInfo(Name=intfield)],type=int[FieldInfo" +
-                       "([TraceInfo(Name=stringfield)],type=string,Filter=intField==10)][BaseEventInfo([TraceInfo(Name=event2)]," +
-                       "type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
+                "type=UNKNOWN,level=TRACE_DEBUG,Fields=[FieldInfo([TraceInfo(Name=intfield)],type=int[FieldInfo" +
+                "([TraceInfo(Name=stringfield)],type=string,Filter=intField==10)][BaseEventInfo([TraceInfo(Name=event2)]," +
+                "type=TRACEPOINT,level=TRACE_DEBUG)])]", result);
     }
 
     // ------------------------------------------------------------------------
     // equals
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fUstProviderInfo1.equals(fUstProviderInfo1));
         assertTrue("equals", fUstProviderInfo2.equals(fUstProviderInfo2));
@@ -189,6 +196,10 @@ public class UstProviderInfoTest extends TestCase {
         assertTrue("equals", !fUstProviderInfo2.equals(fUstProviderInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         UstProviderInfo event1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
         UstProviderInfo event2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo2);
@@ -200,6 +211,10 @@ public class UstProviderInfoTest extends TestCase {
         assertTrue("equals", fUstProviderInfo2.equals(event2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         UstProviderInfo UstProvider1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
         UstProviderInfo UstProvider2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
@@ -210,6 +225,10 @@ public class UstProviderInfoTest extends TestCase {
         assertTrue("equals", UstProvider1.equals(UstProvider3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fUstProviderInfo1.equals(null));
         assertTrue("equals", !fUstProviderInfo2.equals(null));
@@ -219,6 +238,10 @@ public class UstProviderInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         UstProviderInfo UstProvider1 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo1);
         UstProviderInfo UstProvider2 = new UstProviderInfo((UstProviderInfo)fUstProviderInfo2);
This page took 0.037572 seconds and 5 git commands to generate.