Methods Summary |
---|
private void | runFailTest(java.math.BigInteger value)Run a failure test. value should be invalid.
UnsignedLong oUnsignedLong = null;
try {
oUnsignedLong = new UnsignedLong(value);
} catch (Exception e) { // catch the validation exception
}
// object is not iNstantiated on bad data value
assertNull("validation restriction failed [" +
String.valueOf(value) + "]. did not restrict bad value.",
oUnsignedLong);
|
private void | runPassTest(java.math.BigInteger value, java.lang.String strValue)Run a successful test. value should be valid. String should come out
as expected.
UnsignedLong oUnsignedLong = null;
try {
oUnsignedLong = new UnsignedLong(value);
} catch (Exception e) { // catch the validation exception
// error!
assertTrue("validation error thrown and it shouldn't be", false);
}
assertEquals("unsigned long not equal: " +
String.valueOf(value), strValue, oUnsignedLong.toString());
|
public void | testMaxInclusive()Test Max unsigned long
runPassTest(new BigInteger("18446744073709551615"),
"18446744073709551615");
|
public void | testMinExclusive()Test that a number at MinInclusive succeeds
runPassTest(BigInteger.ZERO, "0");
|
public void | testNegativeValue()Test that a negative number fails
runFailTest(new BigInteger("-100"));
|
public void | testPositiveValue()Test that a positive value succeeeds
runPassTest(new BigInteger("100"), "100");
|
public void | testTooLarge()
runFailTest(new BigInteger("184467440737095516152"));
|