2015-05-28 13:19:25 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2015-06-08 18:20:02 +02:00
|
|
|
package org.gcube.accounting.datamodel.validations.validators;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
2015-12-18 17:09:05 +01:00
|
|
|
import org.gcube.documentstore.exception.InvalidValueException;
|
2015-12-21 11:50:09 +01:00
|
|
|
import org.gcube.documentstore.records.implementation.validations.validators.ValidLongValidator;
|
2015-05-28 13:19:25 +02:00
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
/**
|
2016-10-12 14:15:28 +02:00
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
2015-05-28 13:19:25 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class ValidTimeValidatorTest {
|
|
|
|
|
|
|
|
@Test
|
2015-06-05 18:50:07 +02:00
|
|
|
public void testPrimitiveLong() throws InvalidValueException{
|
2015-06-03 11:57:38 +02:00
|
|
|
ValidLongValidator validTimeValidator = new ValidLongValidator();
|
2015-05-28 13:19:25 +02:00
|
|
|
long myLong = 4;
|
2015-06-08 18:20:02 +02:00
|
|
|
validTimeValidator.validate(null, myLong, null);
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2015-06-05 18:50:07 +02:00
|
|
|
public void testClassLong() throws InvalidValueException{
|
2015-06-03 11:57:38 +02:00
|
|
|
ValidLongValidator validTimeValidator = new ValidLongValidator();
|
2015-05-28 13:19:25 +02:00
|
|
|
Long myLong = new Long(4);
|
2015-06-08 18:20:02 +02:00
|
|
|
validTimeValidator.validate(null, myLong, null);
|
2015-06-05 18:50:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test(expected=InvalidValueException.class)
|
|
|
|
public void testWrongValue() throws InvalidValueException {
|
|
|
|
ValidLongValidator validTimeValidator = new ValidLongValidator();
|
2015-06-08 18:20:02 +02:00
|
|
|
validTimeValidator.validate(null, "test", null);
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|