IN PROGRESS - BATCH-709: Change all collections to use generics
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.springframework.batch.repeat.exception;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -55,7 +56,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
return "RuntimeException";
|
||||
}
|
||||
});
|
||||
handler.setThresholds(Collections.singletonMap("RuntimeException", new Integer(1)));
|
||||
handler.setThresholds(Collections.singletonMap((Object)"RuntimeException", new Integer(1)));
|
||||
// No exception...
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
RepeatContextCounter counter = new RepeatContextCounter(context, RethrowOnThresholdExceptionHandler.class.getName() + ".RuntimeException");
|
||||
@@ -69,7 +70,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
return "RuntimeException";
|
||||
}
|
||||
});
|
||||
handler.setThresholds(Collections.singletonMap("RuntimeException", new Integer(2)));
|
||||
handler.setThresholds(Collections.singletonMap((Object)"RuntimeException", new Integer(2)));
|
||||
// No exception...
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
@@ -81,16 +82,6 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
assertEquals("Foo", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testNonIntegerAsThreshold() throws Exception {
|
||||
try {
|
||||
handler.setThresholds(Collections.singletonMap("RuntimeException", new Long(1)));
|
||||
fail("Expected IllegalStateException");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testNotUseParent() throws Throwable {
|
||||
handler.setExceptionClassifier(new ExceptionClassifierSupport() {
|
||||
@@ -98,7 +89,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
return "RuntimeException";
|
||||
}
|
||||
});
|
||||
handler.setThresholds(Collections.singletonMap("RuntimeException", new Integer(1)));
|
||||
handler.setThresholds(Collections.singletonMap((Object)"RuntimeException", new Integer(1)));
|
||||
// No exception...
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
context = new RepeatContextSupport(parent);
|
||||
@@ -117,7 +108,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
return "RuntimeException";
|
||||
}
|
||||
});
|
||||
handler.setThresholds(Collections.singletonMap("RuntimeException", new Integer(1)));
|
||||
handler.setThresholds(Collections.singletonMap((Object)"RuntimeException", new Integer(1)));
|
||||
handler.setUseParent(true);
|
||||
// No exception...
|
||||
handler.handleException(context, new RuntimeException("Foo"));
|
||||
@@ -133,7 +124,7 @@ public class RethrowOnThresholdExceptionHandlerTests extends TestCase {
|
||||
|
||||
public void testNotStringAsKey() throws Exception {
|
||||
try {
|
||||
handler.setThresholds(Collections.singletonMap(RuntimeException.class, new Integer(1)));
|
||||
handler.setThresholds(Collections.singletonMap((Object)RuntimeException.class, new Integer(1)));
|
||||
// It's not an error, but not advised...
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
|
||||
Reference in New Issue
Block a user