我有这个测试
@Test
public void mustPostAccountCreationExceptionWithMoreThanTwoDigitsAfterComma(){
thrown.expect(ConstraintViolationException.class);
account.setSaldo(new BigDecimal("12.000"));
accountRepository.save(account);
}
这场saldo
的验证:
@Digits(fraction = 2, integer = 9)
private BigDecimal saldo;
但是H2没有用,Postgresql也可以
要添加pom.xml:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.196</version>
<scope>test</scope>
并删除Postgresql的config-beans或发布我的项目,我可以帮助你