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