Add some missing tests.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1600868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d96586563c
commit
ba8c6f6d6f
|
@ -1045,6 +1045,30 @@ public class ValidateTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsInstanceOf_withMessageArgs() {
|
||||||
|
Validate.isInstanceOf(String.class, "hi", "Error %s=%s", "Name", "Value");
|
||||||
|
Validate.isInstanceOf(Integer.class, 1, "Error %s=%s", "Name", "Value");
|
||||||
|
try {
|
||||||
|
Validate.isInstanceOf(List.class, "hi", "Error %s=%s", "Name", "Value");
|
||||||
|
fail("Expecting IllegalArgumentException");
|
||||||
|
} catch(final IllegalArgumentException e) {
|
||||||
|
assertEquals("Error Name=Value", e.getMessage());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Validate.isInstanceOf(List.class, "hi", "Error %s=%s", List.class, "Value");
|
||||||
|
fail("Expecting IllegalArgumentException");
|
||||||
|
} catch(final IllegalArgumentException e) {
|
||||||
|
assertEquals("Error interface java.util.List=Value", e.getMessage());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Validate.isInstanceOf(List.class, "hi", "Error %s=%s", List.class, null);
|
||||||
|
fail("Expecting IllegalArgumentException");
|
||||||
|
} catch(final IllegalArgumentException e) {
|
||||||
|
assertEquals("Error interface java.util.List=null", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAssignable() {
|
public void testIsAssignable() {
|
||||||
Validate.isAssignableFrom(CharSequence.class, String.class);
|
Validate.isAssignableFrom(CharSequence.class, String.class);
|
||||||
|
|
Loading…
Reference in New Issue