### Question:
OrCondition implements TransitionCondition { @Override public boolean allow(Object event, Object entity, State state) { for (TransitionCondition condition : conditions) { if (condition.allow(event, entity, state)) return true; } return false; } OrCondition(TransitionCondition... conditions); @Override boolean allow(Object event, Object entity, State state);  }### Answer:
@Test public void test() { final Random rand = new Random(); final int conditionCount = rand.nextInt(20) + 1; final Mockery context = new Mockery(); final State mockState = new State("test", StateType.ACTIVE); final TransitionCondition[] conditions = new TransitionCondition[conditionCount]; for (int i = 0; i < conditions.length; i++) { conditions[i] = context.mock(TransitionCondition.class, "condition" + i); } OrCondition condition = new OrCondition(conditions); context.checking(new Expectations() { { for (int i = 0; i < conditions.length; i++) { oneOf(conditions[i]).allow(event, entity, mockState); will(returnValue(false)); } } }); assertFalse(condition.allow(event, entity, mockState)); context.assertIsSatisfied(); context.checking(new Expectations() { { for (int i = 0; i < conditions.length; i++) { allowing(conditions[i]).allow(event, entity, mockState); will(returnValue(true)); } } }); assertTrue(condition.allow(event, entity, mockState)); context.assertIsSatisfied(); for (int i = 0; i < 10; i++) { context.checking(new Expectations() { { boolean result = false; for (int i = 0; i < conditions.length; i++) { boolean value = rand.nextBoolean(); result |= value; if (i == conditions.length - 1 && !result) value = true; allowing(conditions[i]).allow(event, entity, mockState); will(returnValue(value)); } } }); assertTrue(condition.allow(event, entity, mockState)); context.assertIsSatisfied(); } }