diff --git a/src/test/org/apache/commons/lang/CharRangeTest.java b/src/test/org/apache/commons/lang/CharRangeTest.java index 5807d1b04..7af42b02c 100644 --- a/src/test/org/apache/commons/lang/CharRangeTest.java +++ b/src/test/org/apache/commons/lang/CharRangeTest.java @@ -356,6 +356,7 @@ public void testContains_Charrange() { public void testContainsNullArg() { CharRange range = new CharRange('a'); try { + @SuppressWarnings("unused") boolean contains = range.contains(null); } catch(IllegalArgumentException e) { assertEquals("The Range must not be null", e.getMessage()); diff --git a/src/test/org/apache/commons/lang/StringUtilsTest.java b/src/test/org/apache/commons/lang/StringUtilsTest.java index 6dc11ae66..465d2ab51 100644 --- a/src/test/org/apache/commons/lang/StringUtilsTest.java +++ b/src/test/org/apache/commons/lang/StringUtilsTest.java @@ -1651,12 +1651,14 @@ public void testGetLevenshteinDistance_StringString() { assertEquals(8, StringUtils.getLevenshteinDistance("zzzzzzzz", "hippo") ); assertEquals(1, StringUtils.getLevenshteinDistance("hello", "hallo") ); try { + @SuppressWarnings("unused") int d = StringUtils.getLevenshteinDistance("a", null); fail("expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { // empty } try { + @SuppressWarnings("unused") int d = StringUtils.getLevenshteinDistance(null, "a"); fail("expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { diff --git a/src/test/org/apache/commons/lang/builder/EqualsBuilderTest.java b/src/test/org/apache/commons/lang/builder/EqualsBuilderTest.java index 141750e9c..1bcf69520 100644 --- a/src/test/org/apache/commons/lang/builder/EqualsBuilderTest.java +++ b/src/test/org/apache/commons/lang/builder/EqualsBuilderTest.java @@ -126,6 +126,7 @@ public TestEmptySubObject(int a) { } static class TestTSubObject extends TestObject { + @SuppressWarnings("unused") private transient int t; public TestTSubObject(int a, int t) { super(a); @@ -134,6 +135,7 @@ public TestTSubObject(int a, int t) { } static class TestTTSubObject extends TestTSubObject { + @SuppressWarnings("unused") private transient int tt; public TestTTSubObject(int a, int t, int tt) { super(a, t); @@ -142,6 +144,7 @@ public TestTTSubObject(int a, int t, int tt) { } static class TestTTLeafObject extends TestTTSubObject { + @SuppressWarnings("unused") private int leafValue; public TestTTLeafObject(int a, int t, int tt, int leafValue) { super(a, t, tt); @@ -998,8 +1001,11 @@ public void testReflectionEqualsExcludeFields() throws Exception { } static class TestObjectWithMultipleFields { + @SuppressWarnings("unused") private TestObject one; + @SuppressWarnings("unused") private TestObject two; + @SuppressWarnings("unused") private TestObject three; public TestObjectWithMultipleFields(int one, int two, int three) { diff --git a/src/test/org/apache/commons/lang/builder/ReflectionToStringBuilderExcludeTest.java b/src/test/org/apache/commons/lang/builder/ReflectionToStringBuilderExcludeTest.java index 27970bcc9..4d7bbad1b 100644 --- a/src/test/org/apache/commons/lang/builder/ReflectionToStringBuilderExcludeTest.java +++ b/src/test/org/apache/commons/lang/builder/ReflectionToStringBuilderExcludeTest.java @@ -33,8 +33,10 @@ public class ReflectionToStringBuilderExcludeTest extends TestCase { class TestFixture { + @SuppressWarnings("unused") private String secretField = SECRET_VALUE; + @SuppressWarnings("unused") private String showField = NOT_SECRET_VALUE; } diff --git a/src/test/org/apache/commons/lang/exception/AbstractNestableTest.java b/src/test/org/apache/commons/lang/exception/AbstractNestableTest.java index bdf4c535d..25de08664 100644 --- a/src/test/org/apache/commons/lang/exception/AbstractNestableTest.java +++ b/src/test/org/apache/commons/lang/exception/AbstractNestableTest.java @@ -169,6 +169,7 @@ public void testGetMessageI() // Test for index out of bounds try { + @SuppressWarnings("unused") String msg = ne.getMessage(-1); fail("getMessage(-1) should have thrown IndexOutOfBoundsException"); } @@ -177,6 +178,7 @@ public void testGetMessageI() } try { + @SuppressWarnings("unused") String msg = ne.getMessage(msgs.length + 100); fail("getMessage(999) should have thrown IndexOutOfBoundsException"); } @@ -429,6 +431,7 @@ public void testIndexOfThrowableI() // Test for index out of bounds try { + @SuppressWarnings("unused") int index = n.indexOfThrowable(getTester1Class(), -1); fail("method should have thrown IndexOutOfBoundsException"); } @@ -437,6 +440,7 @@ public void testIndexOfThrowableI() } try { + @SuppressWarnings("unused") int index = n.indexOfThrowable(getTester1Class(), 5); fail("method should have thrown IndexOutOfBoundsException"); }