ReplacementOperation implements Operation { public void doOperation(Individual operand) {} ReplacementOperation(int size);  ReplacementOperation(Properties p); void setProperties(Properties p); void doOperation(Individual operand); void doOperation(List<Individual> operand); void doOperation(List<Individual> operand, int size); void setReplacementSize(int i); int getReplacementSize();  }
@Test public void testDoOperation_List() { System.out.println("* ReplacementOperation: doOperation"); ReplacementOperation instance = new ReplacementOperation(2); List<Individual> reference = operands; instance.doOperation(operands); assertEquals(operands.size(), 8); assertSame(operands,reference); List<Double> dL = new ArrayList<Double>(); List<Double> fL = new ArrayList<Double>(); for (int i = operands.size(); i > 0; i--) { dL.add(new Double(i)); fL.add(operands.get(operands.size()-i).getFitness().getDouble()); } JUnitHelper.checkList(fL, dL); }
@Test public void testDoOperation_List_int() { System.out.println("* ReplacementOperation: doOperation"); ReplacementOperation instance = new ReplacementOperation(2); List<Individual> reference = operands; instance.doOperation(operands,4); assertEquals(operands.size(), 6); assertSame(operands,reference); List<Double> dL = new ArrayList<Double>(); List<Double> fL = new ArrayList<Double>(); for (int i = operands.size(); i > 0; i--) { dL.add(new Double(i)); fL.add(operands.get(operands.size()-i).getFitness().getDouble()); } JUnitHelper.checkList(fL, dL); }