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 / EventInfoTest.java
index 10ac5932d93ff6186bee878fb105e2912aacca97..2466c5440798597859d28bfbd8a266812ba8ad00 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,62 +8,59 @@
  *
  * 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.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
- * The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
+ * The class <code>EventInfoTest</code> contains test for the class
+ * <code>{@link EventInfo}</code>.
  */
-@SuppressWarnings({"nls", "javadoc"})
-public class EventInfoTest extends TestCase {
+@SuppressWarnings("nls")
+public class EventInfoTest {
 
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
+
     private IEventInfo fEventInfo1 = null;
     private IEventInfo fEventInfo2 = null;
 
     // ------------------------------------------------------------------------
     // Housekeeping
     // ------------------------------------------------------------------------
+
     /**
      * Perform pre-test initialization.
-     *
-     * @throws Exception if the initialization fails for some reason
-     *
      */
-    @Override
-    public void setUp() throws Exception {
+    @Before
+    public void setUp() {
         ModelImplFactory factory = new ModelImplFactory();
         fEventInfo1 = factory.getEventInfo1();
         fEventInfo2 = factory.getEventInfo2();
     }
 
-    /**
-     * 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 testBaseEventInfo() {
         EventInfo fixture = new EventInfo("event");
         assertNotNull(fixture);
@@ -87,6 +84,7 @@ public class EventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventInfoCopy() {
         EventInfo info = new EventInfo((EventInfo)fEventInfo1);
 
@@ -98,6 +96,7 @@ public class EventInfoTest extends TestCase {
     /**
      * Test Copy Constructor
      */
+    @Test
     public void testEventCopy2() {
         try {
             EventInfo info = null;
@@ -112,6 +111,7 @@ public class EventInfoTest extends TestCase {
     /**
      *  Getter/Setter tests
      */
+    @Test
     public void testGetAndSetter() {
         EventInfo fixture = new EventInfo("event");
 
@@ -193,6 +193,7 @@ public class EventInfoTest extends TestCase {
     /**
      * Run the String toString() method test.
      */
+    @Test
     public void testToString_1() {
         EventInfo fixture = new EventInfo("event");
         fixture.setName("testName");
@@ -207,6 +208,11 @@ public class EventInfoTest extends TestCase {
     // ------------------------------------------------------------------------
     // equals
     // ------------------------------------------------------------------------
+
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsReflexivity() {
         assertTrue("equals", fEventInfo1.equals(fEventInfo1));
         assertTrue("equals", fEventInfo2.equals(fEventInfo2));
@@ -215,6 +221,10 @@ public class EventInfoTest extends TestCase {
         assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsSymmetry() {
         EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
         EventInfo info2 = new EventInfo((EventInfo)fEventInfo2);
@@ -226,6 +236,10 @@ public class EventInfoTest extends TestCase {
         assertTrue("equals", fEventInfo2.equals(info2));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsTransivity() {
         EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
         EventInfo info2 = new EventInfo((EventInfo)fEventInfo1);
@@ -236,6 +250,10 @@ public class EventInfoTest extends TestCase {
         assertTrue("equals", info1.equals(info3));
     }
 
+    /**
+     * Run the equals() method test.
+     */
+    @Test
     public void testEqualsNull() {
         assertTrue("equals", !fEventInfo1.equals(null));
         assertTrue("equals", !fEventInfo2.equals(null));
@@ -245,6 +263,10 @@ public class EventInfoTest extends TestCase {
     // hashCode
     // ------------------------------------------------------------------------
 
+    /**
+     * Run the hashCode() method test.
+     */
+    @Test
     public void testHashCode() {
         EventInfo info1 = new EventInfo((EventInfo)fEventInfo1);
         EventInfo info2 = new EventInfo((EventInfo)fEventInfo2);
This page took 0.029446 seconds and 5 git commands to generate.