use of org.assertj.core.api.Assertions.assertThatThrownBy in project midpoint by Evolveum.
the class SqaleRepoModifyObjectTest method test811ModifyDynamicallyWithFailingSupplier.
@Test
public void test811ModifyDynamicallyWithFailingSupplier() {
OperationResult result = createOperationResult();
MUser originalRow = selectObjectByOid(QUser.class, user1Oid);
expect("modifyObjectDynamically with failing supplier fails");
Assertions.assertThatThrownBy(() -> repositoryService.modifyObjectDynamically(UserType.class, user1Oid, null, u -> {
throw new RuntimeException("Random exception");
}, null, result)).isInstanceOf(SystemException.class).hasMessage("Random exception");
and("operation is fatal error and modification is not executed");
assertThatOperationResult(result).isFatalError();
MUser row = selectObjectByOid(QUser.class, user1Oid);
assertThat(row.version).isEqualTo(originalRow.version);
}
Aggregations