### Question:
DefaultWizardRules implements WizardRules { @Override public boolean canGoNext() { return myStepModel.getCurrentStep() < myStepModel.getStepCount() - 1 && myStepModel.getStepState(myStepModel.getCurrentStep() + 1) != StepState.DISABLED; } DefaultWizardRules(WizardStepListModel stepModel); @Override boolean canFinish(); @Override boolean canGoNext(); @Override boolean canGoPrevious();  }### Answer:
@Test public void testCanGoNext() { WizardStepListModel stepModel = EasyMock.createMock(WizardStepListModel.class); EasyMock.expect(Integer.valueOf(stepModel.getCurrentStep())).andReturn(Integer.valueOf(1)); EasyMock.expect(Integer.valueOf(stepModel.getStepCount())).andReturn(Integer.valueOf(2)); EasyMock.replay(stepModel); Assert.assertFalse(new DefaultWizardRules(stepModel).canGoNext()); for (StepState state : EnumSet.complementOf(EnumSet.of(StepState.DISABLED))) { EasyMock.reset(stepModel); EasyMock.expect(Integer.valueOf(stepModel.getCurrentStep())).andReturn(Integer.valueOf(0)).anyTimes(); EasyMock.expect(Integer.valueOf(stepModel.getStepCount())).andReturn(Integer.valueOf(2)).anyTimes(); EasyMock.expect(stepModel.getStepState(1)).andReturn(state); EasyMock.replay(stepModel); Assert.assertTrue(new DefaultWizardRules(stepModel).canGoNext()); } EasyMock.reset(stepModel); EasyMock.expect(Integer.valueOf(stepModel.getCurrentStep())).andReturn(Integer.valueOf(0)).anyTimes(); EasyMock.expect(Integer.valueOf(stepModel.getStepCount())).andReturn(Integer.valueOf(2)).anyTimes(); EasyMock.expect(stepModel.getStepState(1)).andReturn(StepState.DISABLED); EasyMock.replay(stepModel); Assert.assertFalse(new DefaultWizardRules(stepModel).canGoNext()); }