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:
parent
1ee65910e3
commit
94c5cbb462
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,26 +54,14 @@ public int hashCode() {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testConstructorEx1() {
|
public void testConstructorEx1() {
|
||||||
try {
|
new HashCodeBuilder(0, 0);
|
||||||
new HashCodeBuilder(0, 0);
|
|
||||||
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testConstructorEx2() {
|
public void testConstructorEx2() {
|
||||||
try {
|
new HashCodeBuilder(2, 2);
|
||||||
new HashCodeBuilder(2, 2);
|
|
||||||
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TestObject {
|
static class TestObject {
|
||||||
|
@ -151,54 +137,29 @@ public void testReflectionHierarchyHashCode() {
|
||||||
123456, 7890, 0), true));
|
123456, 7890, 0), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testReflectionHierarchyHashCodeEx1() {
|
public void testReflectionHierarchyHashCodeEx1() {
|
||||||
try {
|
HashCodeBuilder.reflectionHashCode(0, 0, new TestSubObject(0, 0, 0), true);
|
||||||
HashCodeBuilder.reflectionHashCode(0, 0, new TestSubObject(0, 0, 0), true);
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testReflectionHierarchyHashCodeEx2() {
|
public void testReflectionHierarchyHashCodeEx2() {
|
||||||
try {
|
HashCodeBuilder.reflectionHashCode(2, 2, new TestSubObject(0, 0, 0), true);
|
||||||
HashCodeBuilder.reflectionHashCode(2, 2, new TestSubObject(0, 0, 0), true);
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testReflectionHashCodeEx1() {
|
public void testReflectionHashCodeEx1() {
|
||||||
try {
|
HashCodeBuilder.reflectionHashCode(0, 0, new TestObject(0), true);
|
||||||
HashCodeBuilder.reflectionHashCode(0, 0, new TestObject(0), true);
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testReflectionHashCodeEx2() {
|
public void testReflectionHashCodeEx2() {
|
||||||
try {
|
HashCodeBuilder.reflectionHashCode(2, 2, new TestObject(0), true);
|
||||||
HashCodeBuilder.reflectionHashCode(2, 2, new TestObject(0), true);
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testReflectionHashCodeEx3() {
|
public void testReflectionHashCodeEx3() {
|
||||||
try {
|
HashCodeBuilder.reflectionHashCode(13, 19, null, true);
|
||||||
HashCodeBuilder.reflectionHashCode(13, 19, null, true);
|
|
||||||
} catch (IllegalArgumentException ex) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue