EliteReplacementOperation implements Operation { public void setProperties(Properties p) { int value = 0; String key = Constants.ELITE_SIZE; value = Integer.parseInt(p.getProperty(key, "0")); if (value == -1) { value = 0; } this.eliteSize = value; } EliteReplacementOperation(int size);  EliteReplacementOperation(Properties p); void setProperties(Properties p); void doOperation(Individual operand); void doOperation(List<Individual> operand); int getEliteSize(); void printHelp(Fitness[] fA);  }
@Test public void testSetProperties() { System.out.println("* EliteReplacementOperation: setProperties"); Properties p = GrammarCreator.getProperties(); p.setProperty(Constants.ELITE_SIZE, "1"); EliteReplacementOperation instance = new EliteReplacementOperation(0); instance.setProperties(p); assertEquals(instance.getEliteSize(), Integer.parseInt(p.getProperty(Constants.ELITE_SIZE))); instance = new EliteReplacementOperation(0); p.setProperty(Constants.ELITE_SIZE, "-1"); instance.setProperties(p); assertEquals(instance.getEliteSize(), 0); }