Fix internal raw types
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@829395 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a80284f4c5
commit
96dea6c4f6
|
@ -70,7 +70,7 @@ public class ArrayUtilsTest extends TestCase {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testConstructor() {
|
public void testConstructor() {
|
||||||
assertNotNull(new ArrayUtils());
|
assertNotNull(new ArrayUtils());
|
||||||
Constructor[] cons = ArrayUtils.class.getDeclaredConstructors();
|
Constructor<?>[] cons = ArrayUtils.class.getDeclaredConstructors();
|
||||||
assertEquals(1, cons.length);
|
assertEquals(1, cons.length);
|
||||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||||
assertEquals(true, Modifier.isPublic(ArrayUtils.class.getModifiers()));
|
assertEquals(true, Modifier.isPublic(ArrayUtils.class.getModifiers()));
|
||||||
|
@ -170,7 +170,7 @@ public class ArrayUtilsTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testToMap() {
|
public void testToMap() {
|
||||||
Map map = ArrayUtils.toMap(new String[][] {{"foo", "bar"}, {"hello", "world"}});
|
Map<?, ?> map = ArrayUtils.toMap(new String[][] {{"foo", "bar"}, {"hello", "world"}});
|
||||||
|
|
||||||
assertEquals("bar", map.get("foo"));
|
assertEquals("bar", map.get("foo"));
|
||||||
assertEquals("world", map.get("hello"));
|
assertEquals("world", map.get("hello"));
|
||||||
|
@ -189,7 +189,7 @@ public class ArrayUtilsTest extends TestCase {
|
||||||
fail("exception expected");
|
fail("exception expected");
|
||||||
} catch (IllegalArgumentException ex) {}
|
} catch (IllegalArgumentException ex) {}
|
||||||
|
|
||||||
map = ArrayUtils.toMap(new Object[] {new Map.Entry() {
|
map = ArrayUtils.toMap(new Object[] {new Map.Entry<Object, Object>() {
|
||||||
public Object getKey() {
|
public Object getKey() {
|
||||||
return "foo";
|
return "foo";
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,9 +176,9 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testNotEmptyCollection1() {
|
public void testNotEmptyCollection1() {
|
||||||
Collection coll = new ArrayList();
|
Collection<Integer> coll = new ArrayList<Integer>();
|
||||||
try {
|
try {
|
||||||
Validate.notEmpty((Collection) null);
|
Validate.notEmpty((Collection<?>) null);
|
||||||
fail("Expecting IllegalArgumentException");
|
fail("Expecting IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
assertEquals("The validated collection is empty", ex.getMessage());
|
assertEquals("The validated collection is empty", ex.getMessage());
|
||||||
|
@ -195,9 +195,9 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testNotEmptyCollection2() {
|
public void testNotEmptyCollection2() {
|
||||||
Collection coll = new ArrayList();
|
Collection<Integer> coll = new ArrayList<Integer>();
|
||||||
try {
|
try {
|
||||||
Validate.notEmpty((Collection) null, "MSG");
|
Validate.notEmpty((Collection<?>) null, "MSG");
|
||||||
fail("Expecting IllegalArgumentException");
|
fail("Expecting IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
assertEquals("MSG", ex.getMessage());
|
assertEquals("MSG", ex.getMessage());
|
||||||
|
@ -214,9 +214,9 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testNotEmptyMap1() {
|
public void testNotEmptyMap1() {
|
||||||
Map map = new HashMap();
|
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||||
try {
|
try {
|
||||||
Validate.notEmpty((Map) null);
|
Validate.notEmpty((Map<?, ?>) null);
|
||||||
fail("Expecting IllegalArgumentException");
|
fail("Expecting IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
assertEquals("The validated map is empty", ex.getMessage());
|
assertEquals("The validated map is empty", ex.getMessage());
|
||||||
|
@ -233,9 +233,9 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testNotEmptyMap2() {
|
public void testNotEmptyMap2() {
|
||||||
Map map = new HashMap();
|
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||||
try {
|
try {
|
||||||
Validate.notEmpty((Map) null, "MSG");
|
Validate.notEmpty((Map<?, ?>) null, "MSG");
|
||||||
fail("Expecting IllegalArgumentException");
|
fail("Expecting IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
assertEquals("MSG", ex.getMessage());
|
assertEquals("MSG", ex.getMessage());
|
||||||
|
@ -510,12 +510,12 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testNoNullElementsCollection1() {
|
public void testNoNullElementsCollection1() {
|
||||||
List coll = new ArrayList();
|
List<String> coll = new ArrayList<String>();
|
||||||
coll.add("a");
|
coll.add("a");
|
||||||
coll.add("b");
|
coll.add("b");
|
||||||
Validate.noNullElements(coll);
|
Validate.noNullElements(coll);
|
||||||
try {
|
try {
|
||||||
Validate.noNullElements((Collection) null);
|
Validate.noNullElements((Collection<?>) null);
|
||||||
fail("Expecting IllegalArgumentException");
|
fail("Expecting IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
assertEquals("The validated object is null", ex.getMessage());
|
assertEquals("The validated object is null", ex.getMessage());
|
||||||
|
@ -531,12 +531,12 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testNoNullElementsCollection2() {
|
public void testNoNullElementsCollection2() {
|
||||||
List coll = new ArrayList();
|
List<String> coll = new ArrayList<String>();
|
||||||
coll.add("a");
|
coll.add("a");
|
||||||
coll.add("b");
|
coll.add("b");
|
||||||
Validate.noNullElements(coll, "MSG");
|
Validate.noNullElements(coll, "MSG");
|
||||||
try {
|
try {
|
||||||
Validate.noNullElements((Collection) null, "MSG");
|
Validate.noNullElements((Collection<?>) null, "MSG");
|
||||||
fail("Expecting IllegalArgumentException");
|
fail("Expecting IllegalArgumentException");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
assertEquals("The validated object is null", ex.getMessage());
|
assertEquals("The validated object is null", ex.getMessage());
|
||||||
|
@ -552,7 +552,7 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
public void testAllElementsOfType() {
|
public void testAllElementsOfType() {
|
||||||
List coll = new ArrayList();
|
List<Object> coll = new ArrayList<Object>();
|
||||||
coll.add("a");
|
coll.add("a");
|
||||||
coll.add("b");
|
coll.add("b");
|
||||||
Validate.allElementsOfType(coll, String.class, "MSG");
|
Validate.allElementsOfType(coll, String.class, "MSG");
|
||||||
|
@ -571,7 +571,7 @@ public class ValidateTest extends TestCase {
|
||||||
assertEquals("The validated collection contains an element not of type java.lang.String at index: 1", ex.getMessage());
|
assertEquals("The validated collection contains an element not of type java.lang.String at index: 1", ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
coll = new ArrayList();
|
coll = new ArrayList<Object>();
|
||||||
coll.add(new Integer(5));
|
coll.add(new Integer(5));
|
||||||
coll.add(new Double(2.0d));
|
coll.add(new Double(2.0d));
|
||||||
Validate.allElementsOfType(coll, Number.class, "MSG");
|
Validate.allElementsOfType(coll, Number.class, "MSG");
|
||||||
|
@ -591,7 +591,7 @@ public class ValidateTest extends TestCase {
|
||||||
|
|
||||||
public void testConstructor() {
|
public void testConstructor() {
|
||||||
assertNotNull(new Validate());
|
assertNotNull(new Validate());
|
||||||
Constructor[] cons = Validate.class.getDeclaredConstructors();
|
Constructor<?>[] cons = Validate.class.getDeclaredConstructors();
|
||||||
assertEquals(1, cons.length);
|
assertEquals(1, cons.length);
|
||||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||||
assertEquals(true, Modifier.isPublic(Validate.class.getModifiers()));
|
assertEquals(true, Modifier.isPublic(Validate.class.getModifiers()));
|
||||||
|
|
Loading…
Reference in New Issue