commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1185699 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
Date Tue, 18 Oct 2011 14:51:31 GMT
Author: ggregory
Date: Tue Oct 18 14:51:31 2011
New Revision: 1185699

URL: http://svn.apache.org/viewvc?rev=1185699&view=rev
Log:
Port to JUnit 4.

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java?rev=1185699&r1=1185698&r2=1185699&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/SimpleToStringStyleTest.java
Tue Oct 18 14:51:31 2011
@@ -16,44 +16,43 @@
  */
 package org.apache.commons.lang3.builder;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.lang3.builder.ToStringStyleTest.Person;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Unit tests {@link org.apache.commons.lang3.builder.SimpleToStringStyleTest}.
  *
  * @version $Id$
  */
-public class SimpleToStringStyleTest extends TestCase {
+public class SimpleToStringStyleTest {
 
     private final Integer base = Integer.valueOf(5);
     
-    public SimpleToStringStyleTest(String name) {
-        super(name);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         ToStringBuilder.setDefaultStyle(ToStringStyle.SIMPLE_STYLE);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
     }
 
     //----------------------------------------------------------------
     
+    @Test
     public void testBlank() {
         assertEquals("", new ToStringBuilder(base).toString());
     }
 
+    @Test
     public void testAppendSuper() {
         assertEquals("", new ToStringBuilder(base).appendSuper("").toString());
         assertEquals("<null>", new ToStringBuilder(base).appendSuper("<null>").toString());
@@ -63,6 +62,7 @@ public class SimpleToStringStyleTest ext
         assertEquals("hello", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
     }
     
+    @Test
     public void testObject() {
         Integer i3 = Integer.valueOf(3);
         Integer i4 = Integer.valueOf(4);
@@ -80,6 +80,7 @@ public class SimpleToStringStyleTest ext
         assertEquals("{}", new ToStringBuilder(base).append("a", (Object) new String[0],
true).toString());
     }
 
+    @Test
     public void testPerson() {
         Person p = new Person();
         p.name = "Jane Q. Public";
@@ -88,12 +89,14 @@ public class SimpleToStringStyleTest ext
         assertEquals("Jane Q. Public,47,false", new ToStringBuilder(p).append("name", p.name).append("age",
p.age).append("smoker", p.smoker).toString());
     }
 
+    @Test
     public void testLong() {
         assertEquals("3", new ToStringBuilder(base).append(3L).toString());
         assertEquals("3", new ToStringBuilder(base).append("a", 3L).toString());
         assertEquals("3,4", new ToStringBuilder(base).append("a", 3L).append("b", 4L).toString());
     }
 
+    @Test
     public void testObjectArray() {
         Object[] array = new Object[] {null, base, new int[] {3, 6}};
         assertEquals("{<null>,5,{3,6}}", new ToStringBuilder(base).append(array).toString());
@@ -103,6 +106,7 @@ public class SimpleToStringStyleTest ext
         assertEquals("<null>", new ToStringBuilder(base).append((Object) array).toString());
     }
 
+    @Test
     public void testLongArray() {
         long[] array = new long[] {1, 2, -3, 4};
         assertEquals("{1,2,-3,4}", new ToStringBuilder(base).append(array).toString());
@@ -112,6 +116,7 @@ public class SimpleToStringStyleTest ext
         assertEquals("<null>", new ToStringBuilder(base).append((Object) array).toString());
     }
 
+    @Test
     public void testLongArrayArray() {
         long[][] array = new long[][] {{1, 2}, null, {5}};
         assertEquals("{{1,2},<null>,{5}}", new ToStringBuilder(base).append(array).toString());



Mime
View raw message