package au.id.zancanaro.javacheck.state.queue.commands; import au.id.zancanaro.javacheck.state.Command; import au.id.zancanaro.javacheck.state.queue.QueueState; import static org.junit.Assert.assertEquals; public class Peek extends Command, Void, T> { @Override public boolean preCondition(QueueState state, Void args) { return state != null && !state.getAbstractQueue().isEmpty(); } @Override public T runCommand(QueueState state, Void args) { return state.getConcreteQueue().peek(); } @Override public void postCondition(QueueState oldState, QueueState newState, Void args, T result) { assertEquals(oldState.getAbstractQueue().get(0), result); } }