@Test public void shouldNotAddConstraintAlreadyExistsInTheStore() throws Exception { // given UniquenessConstraint constraint = new UniquenessConstraint(10, 66); TxState txState = mock(TxState.class); when(txState.nodesWithLabelChanged(anyInt())).thenReturn(DiffSets.<Long>emptyDiffSets()); KernelStatement state = mockedState(txState); when(inner.constraintsGetForLabelAndPropertyKey(10, 66)) .thenAnswer(asAnswer(asList(constraint))); StateHandlingStatementOperations context = newTxStateOps(inner); // when context.uniquenessConstraintCreate(state, 10, 66); // then verify(txState).constraintIndexDoUnRemove(any(IndexDescriptor.class)); }