Remove unthrown Exceptions

assertEquals(true|false => asserTrue|False

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1034827 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-11-13 17:56:26 +00:00
parent eb858c2208
commit 5b76976ce8
1 changed files with 13 additions and 12 deletions

View File

@ -17,8 +17,10 @@
package org.apache.commons.lang3.concurrent; package org.apache.commons.lang3.concurrent;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -251,7 +253,7 @@ public void testHandleCauseNull() throws ConcurrentException {
* Tests handleCauseUnchecked() if the cause is an error. * Tests handleCauseUnchecked() if the cause is an error.
*/ */
@Test @Test
public void testHandleCauseUncheckedError() throws ConcurrentException { public void testHandleCauseUncheckedError() {
Error err = new AssertionError("Test"); Error err = new AssertionError("Test");
try { try {
ConcurrentUtils.handleCauseUnchecked(new ExecutionException(err)); ConcurrentUtils.handleCauseUnchecked(new ExecutionException(err));
@ -265,8 +267,7 @@ public void testHandleCauseUncheckedError() throws ConcurrentException {
* Tests handleCauseUnchecked() if the cause is an unchecked exception. * Tests handleCauseUnchecked() if the cause is an unchecked exception.
*/ */
@Test @Test
public void testHandleCauseUncheckedUncheckedException() public void testHandleCauseUncheckedUncheckedException() {
throws ConcurrentException {
RuntimeException rex = new RuntimeException("Test"); RuntimeException rex = new RuntimeException("Test");
try { try {
ConcurrentUtils.handleCauseUnchecked(new ExecutionException(rex)); ConcurrentUtils.handleCauseUnchecked(new ExecutionException(rex));
@ -296,7 +297,7 @@ public void testHandleCauseUncheckedChecked() {
* exception is thrown. * exception is thrown.
*/ */
@Test @Test
public void testHandleCauseUncheckedNull() throws ConcurrentException { public void testHandleCauseUncheckedNull() {
ConcurrentUtils.handleCauseUnchecked(null); ConcurrentUtils.handleCauseUnchecked(null);
ConcurrentUtils.handleCauseUnchecked(new ExecutionException("Test", ConcurrentUtils.handleCauseUnchecked(new ExecutionException("Test",
null)); null));
@ -379,13 +380,13 @@ public void testInitializeUncheckedEx() throws ConcurrentException {
public void testConstantFuture_Integer() throws Exception { public void testConstantFuture_Integer() throws Exception {
Integer value = new Integer(5); Integer value = new Integer(5);
Future<Integer> test = ConcurrentUtils.constantFuture(value); Future<Integer> test = ConcurrentUtils.constantFuture(value);
assertEquals(true, test.isDone()); assertTrue(test.isDone());
assertSame(value, test.get()); assertSame(value, test.get());
assertSame(value, test.get(1000, TimeUnit.SECONDS)); assertSame(value, test.get(1000, TimeUnit.SECONDS));
assertSame(value, test.get(1000, null)); assertSame(value, test.get(1000, null));
assertEquals(false, test.isCancelled()); assertFalse(test.isCancelled());
assertEquals(false, test.cancel(true)); assertFalse(test.cancel(true));
assertEquals(false, test.cancel(false)); assertFalse(test.cancel(false));
} }
/** /**
@ -395,13 +396,13 @@ public void testConstantFuture_Integer() throws Exception {
public void testConstantFuture_null() throws Exception { public void testConstantFuture_null() throws Exception {
Integer value = null; Integer value = null;
Future<Integer> test = ConcurrentUtils.constantFuture(value); Future<Integer> test = ConcurrentUtils.constantFuture(value);
assertEquals(true, test.isDone()); assertTrue(test.isDone());
assertSame(value, test.get()); assertSame(value, test.get());
assertSame(value, test.get(1000, TimeUnit.SECONDS)); assertSame(value, test.get(1000, TimeUnit.SECONDS));
assertSame(value, test.get(1000, null)); assertSame(value, test.get(1000, null));
assertEquals(false, test.isCancelled()); assertFalse(test.isCancelled());
assertEquals(false, test.cancel(true)); assertFalse(test.cancel(true));
assertEquals(false, test.cancel(false)); assertFalse(test.cancel(false));
} }
} }