Simplify tests by using @Test(expected)

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1344491 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-05-30 22:48:11 +00:00
parent 1ee65910e3
commit 94c5cbb462
1 changed files with 14 additions and 53 deletions

View File

@ -19,8 +19,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import org.junit.Test;
/**
@ -56,26 +54,14 @@ public int hashCode() {
// -----------------------------------------------------------------------
@Test
@Test(expected=IllegalArgumentException.class)
public void testConstructorEx1() {
try {
new HashCodeBuilder(0, 0);
} catch (IllegalArgumentException ex) {
return;
}
fail();
new HashCodeBuilder(0, 0);
}
@Test
@Test(expected=IllegalArgumentException.class)
public void testConstructorEx2() {
try {
new HashCodeBuilder(2, 2);
} catch (IllegalArgumentException ex) {
return;
}
fail();
new HashCodeBuilder(2, 2);
}
static class TestObject {
@ -151,54 +137,29 @@ public void testReflectionHierarchyHashCode() {
123456, 7890, 0), true));
}
@Test
@Test(expected=IllegalArgumentException.class)
public void testReflectionHierarchyHashCodeEx1() {
try {
HashCodeBuilder.reflectionHashCode(0, 0, new TestSubObject(0, 0, 0), true);
} catch (IllegalArgumentException ex) {
return;
}
fail();
HashCodeBuilder.reflectionHashCode(0, 0, new TestSubObject(0, 0, 0), true);
}
@Test
@Test(expected=IllegalArgumentException.class)
public void testReflectionHierarchyHashCodeEx2() {
try {
HashCodeBuilder.reflectionHashCode(2, 2, new TestSubObject(0, 0, 0), true);
} catch (IllegalArgumentException ex) {
return;
}
fail();
HashCodeBuilder.reflectionHashCode(2, 2, new TestSubObject(0, 0, 0), true);
}
@Test
@Test(expected=IllegalArgumentException.class)
public void testReflectionHashCodeEx1() {
try {
HashCodeBuilder.reflectionHashCode(0, 0, new TestObject(0), true);
} catch (IllegalArgumentException ex) {
return;
}
fail();
HashCodeBuilder.reflectionHashCode(0, 0, new TestObject(0), true);
}
@Test
@Test(expected=IllegalArgumentException.class)
public void testReflectionHashCodeEx2() {
try {
HashCodeBuilder.reflectionHashCode(2, 2, new TestObject(0), true);
} catch (IllegalArgumentException ex) {
return;
}
fail();
HashCodeBuilder.reflectionHashCode(2, 2, new TestObject(0), true);
}
@Test
@Test(expected=IllegalArgumentException.class)
public void testReflectionHashCodeEx3() {
try {
HashCodeBuilder.reflectionHashCode(13, 19, null, true);
} catch (IllegalArgumentException ex) {
return;
}
fail();
HashCodeBuilder.reflectionHashCode(13, 19, null, true);
}
@Test