use of com.networknt.status.Status in project light-rest-4j by networknt.
the class IntegerParameterValidatorTest method validate_withNullValue_shouldFail_whenRequired.
@Test
public void validate_withNullValue_shouldFail_whenRequired() {
Status status = classUnderTest.validate(null, intParam(true));
Assert.assertNotNull(status);
// request parameter missing
Assert.assertEquals("ERR11001", status.getCode());
}
use of com.networknt.status.Status in project light-rest-4j by networknt.
the class IntegerParameterValidatorTest method validate_withValueLessThanMin_shouldFail_ifMinSpecified.
@Test
public void validate_withValueLessThanMin_shouldFail_ifMinSpecified() {
Status status = classUnderTest.validate("0", intParam(new BigDecimal(1.0), null));
Assert.assertNotNull(status);
// request parameter number below min
Assert.assertEquals("ERR11011", status.getCode());
}
use of com.networknt.status.Status in project light-rest-4j by networknt.
the class IntegerParameterValidatorTest method validate_withNonNumericValue_shouldFail.
@Test
public void validate_withNonNumericValue_shouldFail() {
Status status = classUnderTest.validate("123a", intParam(true));
Assert.assertNotNull(status);
// request parameter invalid format
Assert.assertEquals("ERR11010", status.getCode());
}
use of com.networknt.status.Status in project light-rest-4j by networknt.
the class IntegerParameterValidatorTest method validate_withNonIntegerValue_shouldFail.
@Test
public void validate_withNonIntegerValue_shouldFail() {
Status status = classUnderTest.validate("123.1", intParam(true));
Assert.assertNotNull(status);
// request parameter invalid format
Assert.assertEquals("ERR11010", status.getCode());
}
use of com.networknt.status.Status in project light-rest-4j by networknt.
the class NumberParameterValidatorTest method validate_withNullValue_shouldFail_whenRequired.
@Test
public void validate_withNullValue_shouldFail_whenRequired() {
Status status = classUnderTest.validate(null, floatParam(true));
Assert.assertNotNull(status);
// request parameter missing
Assert.assertEquals("ERR11001", status.getCode());
}
Aggregations