// Path: MetaHeuristics4Java/src/main/java/de/mh4j/solver/termination/StagnationTermination.java
// public class StagnationTermination implements TerminationCondition {
// 
// 	private final Solver<? extends Solution<?>> solver;
// 	private final int maxNrOfStagnatingSteps;
// 
// 	private int nrOfStagnatingSteps;
// 	private Solution<?> lastSolution;
// 
// 	public StagnationTermination(Solver<? extends Solution<?>> solver,
// 			int maxNrOfStagnatingSteps) {
// 		this.solver = solver;
// 		this.maxNrOfStagnatingSteps = maxNrOfStagnatingSteps;
// 		this.nrOfStagnatingSteps = 0;
// 	}
// 
// 	@Override
// 	public boolean shouldTerminate() {
// 		Solution<?> currentSolution = solver.getCurrentSolution();
// 
// 		if (lastSolution == null) {
// 			lastSolution = currentSolution;
// 			nrOfStagnatingSteps = 0;
// 		} else if (currentSolution.equals(lastSolution)) {
// 			nrOfStagnatingSteps++;
// 		} else {
// 			nrOfStagnatingSteps = 0;
// 			lastSolution = currentSolution;
// 		}
// 
// 		return nrOfStagnatingSteps >= maxNrOfStagnatingSteps;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "stagnation termination condition (" + maxNrOfStagnatingSteps
// 				+ " non-improving steps)";
// 	}
// }
// 
// Path: MetaHeuristics4Java/src/main/java/de/mh4j/solver/termination/TerminationCondition.java
// public interface TerminationCondition {
// 
//     // TODO add javadoc
//     boolean shouldTerminate();
// 
// }


import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.testng.annotations.Test;
import de.mh4j.solver.termination.StagnationTermination;
import de.mh4j.solver.termination.TerminationCondition;
package de.mh4j.solver;




public class StagnationTerminationTest {

    @Test
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void testShouldTerminate() {
        int maxNrOfStagnatingSteps = 50;
        Solver solver = mock(Solver.class);
        when(solver.getCurrentSolution()).thenReturn(mock(Solution.class));
// Path: MetaHeuristics4Java/src/main/java/de/mh4j/solver/termination/StagnationTermination.java
// public class StagnationTermination implements TerminationCondition {
// 
// 	private final Solver<? extends Solution<?>> solver;
// 	private final int maxNrOfStagnatingSteps;
// 
// 	private int nrOfStagnatingSteps;
// 	private Solution<?> lastSolution;
// 
// 	public StagnationTermination(Solver<? extends Solution<?>> solver,
// 			int maxNrOfStagnatingSteps) {
// 		this.solver = solver;
// 		this.maxNrOfStagnatingSteps = maxNrOfStagnatingSteps;
// 		this.nrOfStagnatingSteps = 0;
// 	}
// 
// 	@Override
// 	public boolean shouldTerminate() {
// 		Solution<?> currentSolution = solver.getCurrentSolution();
// 
// 		if (lastSolution == null) {
// 			lastSolution = currentSolution;
// 			nrOfStagnatingSteps = 0;
// 		} else if (currentSolution.equals(lastSolution)) {
// 			nrOfStagnatingSteps++;
// 		} else {
// 			nrOfStagnatingSteps = 0;
// 			lastSolution = currentSolution;
// 		}
// 
// 		return nrOfStagnatingSteps >= maxNrOfStagnatingSteps;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "stagnation termination condition (" + maxNrOfStagnatingSteps
// 				+ " non-improving steps)";
// 	}
// }
// 
// Path: MetaHeuristics4Java/src/main/java/de/mh4j/solver/termination/TerminationCondition.java
// public interface TerminationCondition {
// 
//     // TODO add javadoc
//     boolean shouldTerminate();
// 
// }


// Path: MetaHeuristics4Java/src/test/java/de/mh4j/solver/StagnationTerminationTest.java
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.testng.annotations.Test;
import de.mh4j.solver.termination.StagnationTermination;
import de.mh4j.solver.termination.TerminationCondition;

package de.mh4j.solver;




public class StagnationTerminationTest {

    @Test
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public void testShouldTerminate() {
        int maxNrOfStagnatingSteps = 50;
        Solver solver = mock(Solver.class);
        when(solver.getCurrentSolution()).thenReturn(mock(Solution.class));
        TerminationCondition terminator = new StagnationTermination(solver, maxNrOfStagnatingSteps);