/**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testGetter_0() throws Exception {
   Configuration conf = new Configuration();
   Genotype.setStaticConfiguration(conf);
   assertEquals(false, conf.isLocked());
   FitnessFunction fitFunc = new StaticFitnessFunction(2);
   conf.setFitnessFunction(fitFunc);
   Gene gene = new BooleanGene(conf);
   Chromosome sample = new Chromosome(conf, gene, 55);
   conf.setSampleChromosome(sample);
   NaturalSelector natSel = new WeightedRouletteSelector();
   conf.addNaturalSelector(natSel, false);
   RandomGenerator randGen = new StockRandomGenerator();
   conf.setRandomGenerator(randGen);
   IEventManager evMan = new EventManager();
   conf.setEventManager(evMan);
   GeneticOperator mutOp = new MutationOperator(conf);
   conf.addGeneticOperator(mutOp);
   GeneticOperator croOp = new CrossoverOperator(conf);
   conf.addGeneticOperator(croOp);
   conf.setPopulationSize(7);
   assertEquals(fitFunc, conf.getFitnessFunction());
   assertEquals(natSel, conf.getNaturalSelectors(false).get(0));
   assertEquals(randGen, conf.getRandomGenerator());
   assertEquals(sample, conf.getSampleChromosome());
   assertEquals(evMan, conf.getEventManager());
   assertEquals(7, conf.getPopulationSize());
   assertEquals(2, conf.getGeneticOperators().size());
   assertEquals(mutOp, conf.getGeneticOperators().get(0));
   assertEquals(croOp, conf.getGeneticOperators().get(1));
 }
 /**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testIsLocked_0() throws Exception {
   Configuration conf = new Configuration();
   assertEquals(false, conf.isLocked());
   conf.setFitnessFunction(new StaticFitnessFunction(2));
   conf.setFitnessEvaluator(new DefaultFitnessEvaluator());
   Gene gene = new BooleanGene(conf);
   conf.setSampleChromosome(new Chromosome(conf, gene, 5));
   conf.addNaturalSelector(new WeightedRouletteSelector(conf), false);
   conf.setRandomGenerator(new StockRandomGenerator());
   conf.setEventManager(new EventManager());
   conf.addGeneticOperator(new MutationOperator(conf));
   conf.setPopulationSize(1);
   assertEquals(false, conf.isLocked());
   conf.lockSettings();
   assertEquals(true, conf.isLocked());
 }
 /**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testVerifyStateIsValid_0() throws Exception {
   Configuration conf = new Configuration();
   assertEquals(false, conf.isLocked());
   conf.setFitnessFunction(new StaticFitnessFunction(2));
   try {
     conf.verifyStateIsValid();
     fail();
   } catch (InvalidConfigurationException invex) {; // this is OK
   }
 }
 /**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testVerifyStateIsValid_1() throws Exception {
   Configuration conf = new Configuration();
   assertEquals(false, conf.isLocked());
   conf.setFitnessFunction(new StaticFitnessFunction(2));
   Gene gene = new BooleanGene(conf);
   conf.setSampleChromosome(new Chromosome(conf, gene, 5));
   try {
     conf.verifyStateIsValid();
     fail();
   } catch (InvalidConfigurationException invex) {; // this is OK
   }
 }
 /**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testVerifyStateIsValid_3() throws Exception {
   Configuration conf = new Configuration();
   assertEquals(false, conf.isLocked());
   conf.setFitnessFunction(new StaticFitnessFunction(2));
   Gene gene = new BooleanGene(conf);
   conf.setSampleChromosome(new Chromosome(conf, gene, 5));
   conf.addNaturalSelector(new WeightedRouletteSelector(conf), true);
   conf.setRandomGenerator(new StockRandomGenerator());
   try {
     conf.verifyStateIsValid();
     fail();
   } catch (InvalidConfigurationException invex) {; // this is OK
   }
 }
 /**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testVerifyStateIsValid_7() throws Exception {
   Configuration conf = new Configuration();
   assertEquals(false, conf.isLocked());
   conf.setFitnessFunction(new StaticFitnessFunction(2));
   Gene gene = new BooleanGene(conf);
   conf.setSampleChromosome(new Chromosome(conf, gene, 5));
   conf.addNaturalSelector(new WeightedRouletteSelector(conf), true);
   conf.setRandomGenerator(new StockRandomGenerator());
   conf.setEventManager(new EventManager());
   conf.addGeneticOperator(new MutationOperator(conf));
   conf.setPopulationSize(1);
   try {
     conf.verifyStateIsValid();
     fail();
   } catch (IllegalArgumentException illex) {; // this is OK
   }
 }
 /**
  * @throws Exception
  * @author Klaus Meffert
  */
 public void testLock_1() throws Exception {
   Configuration conf = new Configuration();
   conf.setFitnessFunction(new TestFitnessFunction());
   Gene gene = new BooleanGene(conf);
   Chromosome sample = new Chromosome(conf, gene, 55);
   conf.setSampleChromosome(sample);
   conf.addNaturalSelector(new WeightedRouletteSelector(conf), false);
   conf.setRandomGenerator(new GaussianRandomGenerator());
   conf.setEventManager(new EventManager());
   conf.setFitnessEvaluator(new DefaultFitnessEvaluator());
   conf.addGeneticOperator(new MutationOperator(conf));
   conf.setPopulationSize(1);
   conf.lockSettings();
   assertEquals(true, conf.isLocked());
   try {
     conf.verifyChangesAllowed();
     fail();
   } catch (InvalidConfigurationException invex) {; // this is OK
   }
 }