Adding tests to ensure the public constructors remain
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1066341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad8f15bcb0
commit
05242a9c85
|
@ -16,6 +16,9 @@
|
|||
*/
|
||||
package org.apache.commons.lang3;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
@ -27,6 +30,17 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class CharSequenceUtilsTest extends TestCase {
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testConstructor() {
|
||||
assertNotNull(new CharSequenceUtils());
|
||||
Constructor<?>[] cons = CharSequenceUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(CharSequenceUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(CharSequenceUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testSubSequence() {
|
||||
//
|
||||
// null input
|
||||
|
|
|
@ -20,8 +20,10 @@ import javax.naming.event.ObjectChangeListener;
|
|||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
@ -35,6 +37,16 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class EventUtilsTest extends TestCase
|
||||
{
|
||||
|
||||
public void testConstructor() {
|
||||
assertNotNull(new EventUtils());
|
||||
Constructor<?>[] cons = EventUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(EventUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(EventUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
public void testAddEventListener()
|
||||
{
|
||||
final PropertyChangeSource src = new PropertyChangeSource();
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
*/
|
||||
package org.apache.commons.lang3.reflect;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
@ -56,6 +58,15 @@ public class FieldUtilsTest extends TestCase {
|
|||
privatelyShadowedChild = new PrivatelyShadowedChild();
|
||||
}
|
||||
|
||||
public void testConstructor() {
|
||||
assertNotNull(new FieldUtils());
|
||||
Constructor<?>[] cons = FieldUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(FieldUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(FieldUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
public void testGetField() {
|
||||
assertEquals(Foo.class, FieldUtils.getField(PublicChild.class, "VALUE").getDeclaringClass());
|
||||
assertEquals(parentClass, FieldUtils.getField(PublicChild.class, "s").getDeclaringClass());
|
||||
|
|
Loading…
Reference in New Issue