@Test
  public void shouldGetConstraintsByLabel() throws Exception {
    // given
    UniquenessConstraint constraint1 = new UniquenessConstraint(11, 66);
    UniquenessConstraint constraint2 = new UniquenessConstraint(11, 99);

    TxState txState =
        new TxStateImpl(
            mock(OldTxStateBridge.class), mock(PersistenceManager.class), mock(IdGeneration.class));
    KernelStatement state = mockedState(txState);
    when(inner.constraintsGetForLabelAndPropertyKey(10, 66))
        .thenAnswer(asAnswer(Collections.emptyList()));
    when(inner.constraintsGetForLabelAndPropertyKey(11, 99))
        .thenAnswer(asAnswer(Collections.emptyList()));
    when(inner.constraintsGetForLabel(10)).thenAnswer(asAnswer(Collections.emptyList()));
    when(inner.constraintsGetForLabel(11)).thenAnswer(asAnswer(asIterable(constraint1)));
    StateHandlingStatementOperations context = newTxStateOps(inner);
    context.uniquenessConstraintCreate(state, 10, 66);
    context.uniquenessConstraintCreate(state, 11, 99);

    // when
    Set<UniquenessConstraint> result = asSet(asIterable(context.constraintsGetForLabel(state, 11)));

    // then
    assertEquals(asSet(constraint1, constraint2), result);
  }
  @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));
  }