You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2011/10/18 16:54:00 UTC
svn commit: r1185702 -
/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
Author: ggregory
Date: Tue Oct 18 14:53:59 2011
New Revision: 1185702
URL: http://svn.apache.org/viewvc?rev=1185702&view=rev
Log:
Port to JUnit 4.
Modified:
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java?rev=1185702&r1=1185701&r2=1185702&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/builder/ReflectionToStringBuilderExcludeTest.java Tue Oct 18 14:53:59 2011
@@ -22,14 +22,14 @@ import java.util.Collection;
import java.util.List;
import junit.framework.Assert;
-import junit.framework.TestCase;
import org.apache.commons.lang3.ArrayUtils;
+import org.junit.Test;
/**
* @version $Id$
*/
-public class ReflectionToStringBuilderExcludeTest extends TestCase {
+public class ReflectionToStringBuilderExcludeTest {
class TestFixture {
@SuppressWarnings("unused")
@@ -47,26 +47,31 @@ public class ReflectionToStringBuilderEx
private static final String SECRET_VALUE = "secret value";
+ @Test
public void test_toStringExclude() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), SECRET_FIELD);
this.validateSecretFieldAbsent(toString);
}
+ @Test
public void test_toStringExcludeArray() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{SECRET_FIELD});
this.validateSecretFieldAbsent(toString);
}
+ @Test
public void test_toStringExcludeArrayWithNull() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null});
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeArrayWithNulls() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new String[]{null, null});
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeCollection() {
List<String> excludeList = new ArrayList<String>();
excludeList.add(SECRET_FIELD);
@@ -74,6 +79,7 @@ public class ReflectionToStringBuilderEx
this.validateSecretFieldAbsent(toString);
}
+ @Test
public void test_toStringExcludeCollectionWithNull() {
List<String> excludeList = new ArrayList<String>();
excludeList.add(null);
@@ -81,6 +87,7 @@ public class ReflectionToStringBuilderEx
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeCollectionWithNulls() {
List<String> excludeList = new ArrayList<String>();
excludeList.add(null);
@@ -89,21 +96,25 @@ public class ReflectionToStringBuilderEx
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeEmptyArray() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), ArrayUtils.EMPTY_STRING_ARRAY);
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeEmptyCollection() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), new ArrayList<String>());
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeNullArray() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), (String[]) null);
this.validateSecretFieldPresent(toString);
}
+ @Test
public void test_toStringExcludeNullCollection() {
String toString = ReflectionToStringBuilder.toStringExclude(new TestFixture(), (Collection<String>) null);
this.validateSecretFieldPresent(toString);