### Question:
Conditions { public static Condition onComponents(final List<Class> types) { return new OnComponentCondition(types, true); }  static Condition compose(final List<? extends Condition> conditions); static Condition compose(final Condition ...conditions); static Condition any(final List<? extends Condition> conditions); static Condition any(final Condition ...conditions); static Condition onPropertyExist(final String property); static Condition onPropertyMissing(final String property); static Condition onPropertyEquals(final String property, final String value); static Condition onPropertyNotEquals(final String property, final String value); static Condition onPropertyMatches(final String property, final String pattern); static Condition onPropertyTrue(final String property); static Condition onComponents(final List<Class> types); static Condition onMissingComponent(final List<Class> types); static List<Condition> buildConditionsForAnnotations(final List<ConditionalOn> annotations);  }### Answer:
@Test public void shouldReturnTrueWhenConditionOnComponentGivenRegistered() { Condition condition = Conditions.onComponents(List.of(ConditionsTest.class)); ComponentDescriptor<ConditionsTest> descriptorA = createDescriptor("A", ConditionsTest.class, condition); ComponentDescriptor<ConditionsTest> descriptorB = createDescriptor("B", ConditionsTest.class, null); ComponentFactory mkFactory = Mockito.mock(ComponentFactory.class); Mockito.when(mkFactory.findAllDescriptorsByClass(Mockito.same(ConditionsTest.class))) .thenReturn(List.of(descriptorA, descriptorB)); Assertions.assertTrue(condition.matches(contextWith(mkFactory, descriptorA))); }
@Test public void shouldReturnFalseWhenConditionOnComponentGivenEmpty() { Condition condition = Conditions.onComponents(List.of(ConditionsTest.class)); ComponentDescriptor<ConditionsTest> descriptorA = createDescriptor("A", ConditionsTest.class, condition); ComponentFactory mkFactory = Mockito.mock(ComponentFactory.class); Mockito.when(mkFactory.findAllDescriptorsByClass(Mockito.same(ConditionsTest.class))) .thenReturn(List.of(descriptorA)); Assertions.assertFalse(condition.matches(contextWith(mkFactory, descriptorA))); }