Squashed deprecation warnings in test code.

This commit is contained in:
duncan 2016-12-12 15:11:39 +00:00
parent 795fe5d869
commit 5556118ad1
2 changed files with 14 additions and 1 deletions

View File

@ -238,7 +238,7 @@ public void testLANG571(){
//expected //expected
} }
try { try {
@SuppressWarnings("unused") @SuppressWarnings({ "unused", "deprecation" })
final final
String[] sa = ArrayUtils.add(stringArray, 0, aString); String[] sa = ArrayUtils.add(stringArray, 0, aString);
fail("Should have caused IllegalArgumentException"); fail("Should have caused IllegalArgumentException");
@ -365,6 +365,7 @@ public void testAddObjectArrayToObjectArray() {
} }
@SuppressWarnings("deprecation")
@Test @Test
public void testAddObjectAtIndex() { public void testAddObjectAtIndex() {
Object[] newArray; Object[] newArray;

View File

@ -42,6 +42,18 @@
@SuppressWarnings("deprecation") // deliberate use of deprecated code @SuppressWarnings("deprecation") // deliberate use of deprecated code
public class ArrayUtilsTest { public class ArrayUtilsTest {
static <T> T[] arrayOfTwo(T a, T b) {
return ArrayUtils.toArray(a, b);
}
@Test
public void testBadVarArgs() throws Exception {
@SuppressWarnings("unused") // Need to assign to trigger exception
String[] result = arrayOfTwo("foo", "bar");
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
@Test @Test
public void testConstructor() { public void testConstructor() {