mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Fix compiler warnings in Constants/ConstantsTests
This commit is contained in:
@@ -57,7 +57,7 @@ public class ConstantsTests extends TestCase {
|
||||
public void testGetNames() {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set names = c.getNames("");
|
||||
Set<?> names = c.getNames("");
|
||||
assertEquals(c.getSize(), names.size());
|
||||
assertTrue(names.contains("DOG"));
|
||||
assertTrue(names.contains("CAT"));
|
||||
@@ -75,7 +75,7 @@ public class ConstantsTests extends TestCase {
|
||||
public void testGetValues() {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set values = c.getValues("");
|
||||
Set<?> values = c.getValues("");
|
||||
assertEquals(7, values.size());
|
||||
assertTrue(values.contains(new Integer(0)));
|
||||
assertTrue(values.contains(new Integer(66)));
|
||||
@@ -102,7 +102,7 @@ public class ConstantsTests extends TestCase {
|
||||
try {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set values = c.getValues("");
|
||||
Set<?> values = c.getValues("");
|
||||
assertEquals(7, values.size());
|
||||
assertTrue(values.contains(new Integer(0)));
|
||||
assertTrue(values.contains(new Integer(66)));
|
||||
@@ -130,12 +130,12 @@ public class ConstantsTests extends TestCase {
|
||||
public void testSuffixAccess() {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set names = c.getNamesForSuffix("_PROPERTY");
|
||||
Set<?> names = c.getNamesForSuffix("_PROPERTY");
|
||||
assertEquals(2, names.size());
|
||||
assertTrue(names.contains("NO_PROPERTY"));
|
||||
assertTrue(names.contains("YES_PROPERTY"));
|
||||
|
||||
Set values = c.getValuesForSuffix("_PROPERTY");
|
||||
Set<?> values = c.getValuesForSuffix("_PROPERTY");
|
||||
assertEquals(2, values.size());
|
||||
assertTrue(values.contains(new Integer(3)));
|
||||
assertTrue(values.contains(new Integer(4)));
|
||||
@@ -210,26 +210,26 @@ public class ConstantsTests extends TestCase {
|
||||
|
||||
public void testGetValuesWithNullPrefix() throws Exception {
|
||||
Constants c = new Constants(A.class);
|
||||
Set values = c.getValues(null);
|
||||
Set<?> values = c.getValues(null);
|
||||
assertEquals("Must have returned *all* public static final values", 7, values.size());
|
||||
}
|
||||
|
||||
public void testGetValuesWithEmptyStringPrefix() throws Exception {
|
||||
Constants c = new Constants(A.class);
|
||||
Set values = c.getValues("");
|
||||
Set<Object> values = c.getValues("");
|
||||
assertEquals("Must have returned *all* public static final values", 7, values.size());
|
||||
}
|
||||
|
||||
public void testGetValuesWithWhitespacedStringPrefix() throws Exception {
|
||||
Constants c = new Constants(A.class);
|
||||
Set values = c.getValues(" ");
|
||||
Set<?> values = c.getValues(" ");
|
||||
assertEquals("Must have returned *all* public static final values", 7, values.size());
|
||||
}
|
||||
|
||||
public void testWithClassThatExposesNoConstants() throws Exception {
|
||||
Constants c = new Constants(NoConstants.class);
|
||||
assertEquals(0, c.getSize());
|
||||
final Set values = c.getValues("");
|
||||
final Set<?> values = c.getValues("");
|
||||
assertNotNull(values);
|
||||
assertEquals(0, values.size());
|
||||
}
|
||||
@@ -245,10 +245,11 @@ public class ConstantsTests extends TestCase {
|
||||
|
||||
private static final class NoConstants {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final class A {
|
||||
|
||||
|
||||
public static final int DOG = 0;
|
||||
public static final int CAT = 66;
|
||||
public static final String S1 = "";
|
||||
|
||||
Reference in New Issue
Block a user