Fix some raw types
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@829537 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5ca6b02849
commit
14cde02867
|
@ -82,7 +82,7 @@ public class StrLookupTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMapLookup() {
|
public void testMapLookup() {
|
||||||
Map map = new HashMap();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("key", "value");
|
map.put("key", "value");
|
||||||
map.put("number", new Integer(2));
|
map.put("number", new Integer(2));
|
||||||
assertEquals("value", StrLookup.mapLookup(map).lookup("key"));
|
assertEquals("value", StrLookup.mapLookup(map).lookup("key"));
|
||||||
|
@ -93,7 +93,7 @@ public class StrLookupTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMapLookup_nullMap() {
|
public void testMapLookup_nullMap() {
|
||||||
Map map = null;
|
Map<String, ?> map = null;
|
||||||
assertEquals(null, StrLookup.mapLookup(map).lookup(null));
|
assertEquals(null, StrLookup.mapLookup(map).lookup(null));
|
||||||
assertEquals(null, StrLookup.mapLookup(map).lookup(""));
|
assertEquals(null, StrLookup.mapLookup(map).lookup(""));
|
||||||
assertEquals(null, StrLookup.mapLookup(map).lookup("any"));
|
assertEquals(null, StrLookup.mapLookup(map).lookup("any"));
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.commons.lang.mutable.MutableObject;
|
||||||
*/
|
*/
|
||||||
public class StrSubstitutorTest extends TestCase {
|
public class StrSubstitutorTest extends TestCase {
|
||||||
|
|
||||||
private Map values;
|
private Map<String, String> values;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main method.
|
* Main method.
|
||||||
|
@ -60,7 +60,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
values = new HashMap();
|
values = new HashMap<String, String>();
|
||||||
values.put("animal", "quick brown fox");
|
values.put("animal", "quick brown fox");
|
||||||
values.put("target", "lazy dog");
|
values.put("target", "lazy dog");
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
* The cycle should be detected and cause an exception to be thrown.
|
* The cycle should be detected and cause an exception to be thrown.
|
||||||
*/
|
*/
|
||||||
public void testCyclicReplacement() {
|
public void testCyclicReplacement() {
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put("animal", "${critter}");
|
map.put("animal", "${critter}");
|
||||||
map.put("target", "${pet}");
|
map.put("target", "${pet}");
|
||||||
map.put("pet", "${petCharacteristic} dog");
|
map.put("pet", "${petCharacteristic} dog");
|
||||||
|
@ -283,7 +283,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testResolveVariable() {
|
public void testResolveVariable() {
|
||||||
final StrBuilder builder = new StrBuilder("Hi ${name}!");
|
final StrBuilder builder = new StrBuilder("Hi ${name}!");
|
||||||
Map map = new HashMap();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("name", "commons");
|
map.put("name", "commons");
|
||||||
StrSubstitutor sub = new StrSubstitutor(map) {
|
StrSubstitutor sub = new StrSubstitutor(map) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -312,7 +312,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
* Tests constructor.
|
* Tests constructor.
|
||||||
*/
|
*/
|
||||||
public void testConstructorMapPrefixSuffix() {
|
public void testConstructorMapPrefixSuffix() {
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put("name", "commons");
|
map.put("name", "commons");
|
||||||
StrSubstitutor sub = new StrSubstitutor(map, "<", ">");
|
StrSubstitutor sub = new StrSubstitutor(map, "<", ">");
|
||||||
assertEquals("Hi < commons", sub.replace("Hi $< <name>"));
|
assertEquals("Hi < commons", sub.replace("Hi $< <name>"));
|
||||||
|
@ -322,7 +322,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
* Tests constructor.
|
* Tests constructor.
|
||||||
*/
|
*/
|
||||||
public void testConstructorMapFull() {
|
public void testConstructorMapFull() {
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put("name", "commons");
|
map.put("name", "commons");
|
||||||
StrSubstitutor sub = new StrSubstitutor(map, "<", ">", '!');
|
StrSubstitutor sub = new StrSubstitutor(map, "<", ">", '!');
|
||||||
assertEquals("Hi < commons", sub.replace("Hi !< <name>"));
|
assertEquals("Hi < commons", sub.replace("Hi !< <name>"));
|
||||||
|
@ -406,7 +406,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
* Tests static.
|
* Tests static.
|
||||||
*/
|
*/
|
||||||
public void testStaticReplace() {
|
public void testStaticReplace() {
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put("name", "commons");
|
map.put("name", "commons");
|
||||||
assertEquals("Hi commons!", StrSubstitutor.replace("Hi ${name}!", map));
|
assertEquals("Hi commons!", StrSubstitutor.replace("Hi ${name}!", map));
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
* Tests static.
|
* Tests static.
|
||||||
*/
|
*/
|
||||||
public void testStaticReplacePrefixSuffix() {
|
public void testStaticReplacePrefixSuffix() {
|
||||||
Map map = new HashMap();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
map.put("name", "commons");
|
map.put("name", "commons");
|
||||||
assertEquals("Hi commons!", StrSubstitutor.replace("Hi <name>!", map, "<", ">"));
|
assertEquals("Hi commons!", StrSubstitutor.replace("Hi <name>!", map, "<", ">"));
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ public class StrSubstitutorTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace using object
|
// replace using object
|
||||||
MutableObject obj = new MutableObject(replaceTemplate); // toString returns template
|
MutableObject<String> obj = new MutableObject<String>(replaceTemplate); // toString returns template
|
||||||
assertEquals(expectedResult, sub.replace(obj));
|
assertEquals(expectedResult, sub.replace(obj));
|
||||||
|
|
||||||
// replace in StringBuffer
|
// replace in StringBuffer
|
||||||
|
|
|
@ -491,7 +491,7 @@ public class StrTokenizerTest extends TestCase {
|
||||||
String input = "a b c";
|
String input = "a b c";
|
||||||
StrTokenizer tok = new StrTokenizer(input);
|
StrTokenizer tok = new StrTokenizer(input);
|
||||||
String[] array = tok.getTokenArray();
|
String[] array = tok.getTokenArray();
|
||||||
List list = tok.getTokenList();
|
List<?> list = tok.getTokenList();
|
||||||
|
|
||||||
assertEquals(Arrays.asList(array), list);
|
assertEquals(Arrays.asList(array), list);
|
||||||
assertEquals(3, list.size());
|
assertEquals(3, list.size());
|
||||||
|
@ -813,7 +813,7 @@ public class StrTokenizerTest extends TestCase {
|
||||||
public void testTokenizeSubclassInputChange() {
|
public void testTokenizeSubclassInputChange() {
|
||||||
StrTokenizer tkn = new StrTokenizer("a b c d e") {
|
StrTokenizer tkn = new StrTokenizer("a b c d e") {
|
||||||
@Override
|
@Override
|
||||||
protected List tokenize(char[] chars, int offset, int count) {
|
protected List<String> tokenize(char[] chars, int offset, int count) {
|
||||||
return super.tokenize("w x y z".toCharArray(), 2, 5);
|
return super.tokenize("w x y z".toCharArray(), 2, 5);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -825,8 +825,8 @@ public class StrTokenizerTest extends TestCase {
|
||||||
public void testTokenizeSubclassOutputChange() {
|
public void testTokenizeSubclassOutputChange() {
|
||||||
StrTokenizer tkn = new StrTokenizer("a b c") {
|
StrTokenizer tkn = new StrTokenizer("a b c") {
|
||||||
@Override
|
@Override
|
||||||
protected List tokenize(char[] chars, int offset, int count) {
|
protected List<String> tokenize(char[] chars, int offset, int count) {
|
||||||
List list = super.tokenize(chars, offset, count);
|
List<String> list = super.tokenize(chars, offset, count);
|
||||||
Collections.reverse(list);
|
Collections.reverse(list);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue