@Before public final void setUpPassivateCapabilityDuringUpdateCondition() throws Exception { final CapabilityIdentity id = capabilityIdentity("test"); final CapabilityContext context = mock(CapabilityContext.class); when(context.id()).thenReturn(id); when(reference.context()).thenReturn(context); underTest = new PassivateCapabilityDuringUpdateCondition(eventBus); underTest.setContext(context); underTest.bind(); verify(eventBus).register(underTest); }
@Override public RepositoryConditionSupport setContext(final CapabilityContext context) { checkState(!isActive(), "Cannot contextualize when already bounded"); checkState( capabilityIdentity == null, "Already contextualized with id '" + capabilityIdentity + "'"); capabilityIdentity = context.id(); return this; }