### Question:
ComparatorAspect extends Aspect { public void setRandomly(GeneticConfiguration cfg) { Configuration config = cfg.getConfiguration(); Property p = config.getPropertyByName(prop.getName()); p.setComparator(comparators.get((int) (comparators.size() * Math.random()))); } ComparatorAspect(Property prop, List<Comparator> comparators); void setRandomly(GeneticConfiguration cfg); void setFromOther(GeneticConfiguration cfg1,
                           GeneticConfiguration cfg2);  }### Answer:
@Test public void canAddCustomComparator() { GeneticConfiguration conf = new GeneticConfiguration(config1); Property aspectProp = new PropertyImpl(propName, null, 0.5, 0.5); List<Comparator> compList = new ArrayList<Comparator>(); compList.add(comparator); ComparatorAspect aspect = new ComparatorAspect(aspectProp, compList); aspect.setRandomly(conf); Property updatedProp = config1.getPropertyByName(propName); Comparator randomComparator = updatedProp.getComparator(); assertTrue("should have custom comparator set, but has : " + randomComparator.getClass(), randomComparator.equals(comparator)); }