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 class ArrayUtilsAddTest {
//expected
}
try {
@SuppressWarnings("unused")
@SuppressWarnings({ "unused", "deprecation" })
final
String[] sa = ArrayUtils.add(stringArray, 0, aString);
fail("Should have caused IllegalArgumentException");
@ -365,6 +365,7 @@ public class ArrayUtilsAddTest {
}
@SuppressWarnings("deprecation")
@Test
public void testAddObjectAtIndex() {
Object[] newArray;

View File

@ -42,6 +42,18 @@ import org.junit.Test;
@SuppressWarnings("deprecation") // deliberate use of deprecated code
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
public void testConstructor() {