@Test
public void testWorkerSatisfySeveralCriterions() {
Worker worker1 = Worker.create();
Worker worker2 = Worker.create();
ICriterion criterion1 = justThisResourcesCriterion(worker1);
ICriterion criterion2 = justThisResourcesCriterion(worker1);
ICriterion criterion3 = justThisResourcesCriterion(worker2);
ICriterion criterion4 = justThisResourcesCriterion(worker1, worker2);
assertTrue(criterion1.isSatisfiedBy(worker1));
assertFalse(criterion1.isSatisfiedBy(worker2));
assertTrue(criterion2.isSatisfiedBy(worker1));
assertFalse(criterion2.isSatisfiedBy(worker2));
assertFalse(criterion3.isSatisfiedBy(worker1));
assertTrue(criterion3.isSatisfiedBy(worker2));
assertTrue(criterion4.isSatisfiedBy(worker1));
assertTrue(criterion4.isSatisfiedBy(worker2));
List<ICriterion> criterionList1 = Arrays.asList(criterion1, criterion2);
List<ICriterion> criterionList2 = Arrays.asList(criterion1, criterion2,
criterion3);
List<ICriterion> criterionList3 = Arrays.asList(criterion3, criterion4);
ICriterion compositedCriterion1 = CriterionCompounder.buildAnd(
criterionList1).getResult();
ICriterion compositedCriterion2 = CriterionCompounder.buildAnd(
criterionList2).getResult();
ICriterion compositedCriterion3 = CriterionCompounder.buildAnd(
criterionList3).getResult();
assertTrue(compositedCriterion1.isSatisfiedBy(worker1));
assertFalse(compositedCriterion1.isSatisfiedBy(worker2));
assertFalse(compositedCriterion2.isSatisfiedBy(worker1));
assertFalse(compositedCriterion2.isSatisfiedBy(worker2));
assertFalse(compositedCriterion3.isSatisfiedBy(worker1));
assertTrue(compositedCriterion3.isSatisfiedBy(worker2));
}