@Test public void contextualizationFailsWhenAlreadyContextualized() { thrown.expect(IllegalStateException.class); thrown.expectMessage("Already contextualized"); underTest.setContext(reference.context()); underTest.setContext(reference.context()); }
@Override public CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context) { checkState(!isActive(), "Cannot contextualize when already bounded"); checkState(this.context == null, "Already contextualized with '" + this.context + "'"); this.context = context; return this; }
CapabilityHasNoDuplicatesCondition extends ConditionSupport implements CapabilityContextAware { @Override public CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context) { checkState(!isActive(), "Cannot contextualize when already bounded"); checkState(this.context == null, "Already contextualized with '" + this.context + "'"); this.context = context; return this; } }
CapabilityHasNoDuplicatesCondition extends ConditionSupport implements CapabilityContextAware { @Override public CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context) { checkState(!isActive(), "Cannot contextualize when already bounded"); checkState(this.context == null, "Already contextualized with '" + this.context + "'"); this.context = context; return this; } CapabilityHasNoDuplicatesCondition(final EventManager eventManager); }
CapabilityHasNoDuplicatesCondition extends ConditionSupport implements CapabilityContextAware { @Override public CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context) { checkState(!isActive(), "Cannot contextualize when already bounded"); checkState(this.context == null, "Already contextualized with '" + this.context + "'"); this.context = context; return this; } CapabilityHasNoDuplicatesCondition(final EventManager eventManager); @Override CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context); @Override void doRelease(); @AllowConcurrentEvents @Subscribe void handle(final CapabilityEvent.Created event); @AllowConcurrentEvents @Subscribe void handle(final CapabilityEvent.AfterUpdate event); @AllowConcurrentEvents @Subscribe void handle(final CapabilityEvent.AfterRemove event); @Override String toString(); @Override String explainSatisfied(); @Override String explainUnsatisfied(); }
CapabilityHasNoDuplicatesCondition extends ConditionSupport implements CapabilityContextAware { @Override public CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context) { checkState(!isActive(), "Cannot contextualize when already bounded"); checkState(this.context == null, "Already contextualized with '" + this.context + "'"); this.context = context; return this; } CapabilityHasNoDuplicatesCondition(final EventManager eventManager); @Override CapabilityHasNoDuplicatesCondition setContext(final CapabilityContext context); @Override void doRelease(); @AllowConcurrentEvents @Subscribe void handle(final CapabilityEvent.Created event); @AllowConcurrentEvents @Subscribe void handle(final CapabilityEvent.AfterUpdate event); @AllowConcurrentEvents @Subscribe void handle(final CapabilityEvent.AfterRemove event); @Override String toString(); @Override String explainSatisfied(); @Override String explainUnsatisfied();  }