Skip to content

Commit

Permalink
repo-sqale: test fix for duplicate CID in different containers (it's OK)
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Aug 30, 2021
1 parent 3afd8e3 commit d1b938c
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ public void test290DuplicateCidInsideOneContainerIsCaughtByPrism() {
}

@Test
public void test291DuplicateCidInDifferentContainersIsCaughtByRepo() {
public void test291DuplicateCidInDifferentContainersIsTolerated()
throws SchemaException, ObjectAlreadyExistsException {
OperationResult result = createOperationResult();
long previousUserCount = count(QUser.class);

Expand All @@ -592,13 +593,12 @@ public void test291DuplicateCidInDifferentContainersIsCaughtByRepo() {
.assignment(new AssignmentType(prismContext).id(1L))
.operationExecution(new OperationExecutionType().id(1L));

expect("adding object to repository throws exception");
assertThatThrownBy(() -> repositoryService.addObject(user.asPrismObject(), null, result))
.isInstanceOf(SchemaException.class)
.hasMessageStartingWith("CID 1 is used repeatedly in the object:");
when("adding object to repository throws exception");
repositoryService.addObject(user.asPrismObject(), null, result);

and("no new object is created in the database (transaction is rolled back)");
assertThat(count(QUser.class)).isEqualTo(previousUserCount);
then("operation is success");
assertThatOperationResult(result).isSuccess();
assertThat(count(QUser.class)).isEqualTo(previousUserCount + 1);
}
// endregion

Expand Down

0 comments on commit d1b938c

Please sign in to comment.