Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAS-939 Survey Status Change #289

Merged
merged 12 commits into from
Feb 15, 2024
5 changes: 3 additions & 2 deletions _infra/helm/case/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 12.0.19
version: 12.0.20

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 12.0.19
appVersion: 12.0.20

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import uk.gov.ons.ctp.response.lib.common.state.StateTransitionManagerFactory;

/**
* This is the state transition manager actory for the actionsvc. It intended that this will be
* This is the state transition manager factory for the actionsvc. It intended that this will be
* refactored into a common framework class and that it initialises each entities manager from
* database held transitions.
*/
Expand Down Expand Up @@ -252,7 +252,8 @@ private StateTransitionManager<CaseState, CaseEvent> caseStateTransitionManager(
CategoryDTO.CategoryName.NO_LONGER_REQUIRED,
CaseGroupStatus.NOLONGERREQUIRED);

// New transition to enable users to change completed by phone and no longer required to not
// New transition to enable users to change completed by phone, no longer required and complete
// to not
// started
builder.put(
CaseGroupStatus.COMPLETEDBYPHONE,
Expand All @@ -262,6 +263,10 @@ private StateTransitionManager<CaseState, CaseEvent> caseStateTransitionManager(
CaseGroupStatus.NOLONGERREQUIRED,
CategoryDTO.CategoryName.COMPLETED_TO_NOTSTARTED,
CaseGroupStatus.NOTSTARTED);
builder.put(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very minor but I'd update the comment to include this transition change as well just to prevent any potential future confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment has been updated

CaseGroupStatus.COMPLETE,
CategoryDTO.CategoryName.COMPLETED_TO_NOTSTARTED,
CaseGroupStatus.NOTSTARTED);

// In response-operations-ui, looking at the cases for a survey also shows you an unused IAC
// code. By viewing this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void givenCaseStateSampledInitWhenActivatedThenActionable() throws CTPExc
caseStateMachine.transition(sampledInit, CaseDTO.CaseEvent.ACTIVATED);

// Then
assertEquals(destinationState, CaseState.ACTIONABLE);
assertEquals(CaseState.ACTIONABLE, destinationState);
}

@Test
Expand All @@ -49,7 +49,7 @@ public void givenCaseStateReplacementInitWhenReplacedThenActionable() throws CTP
caseStateMachine.transition(replacementInit, CaseDTO.CaseEvent.REPLACED);

// Then
assertEquals(destinationState, CaseState.ACTIONABLE);
assertEquals(CaseState.ACTIONABLE, destinationState);
}

@Test
Expand All @@ -62,7 +62,7 @@ public void givenCaseStateActionableWhenDisabledThenInactionable() throws CTPExc
caseStateMachine.transition(actionable, CaseDTO.CaseEvent.DISABLED);

// Then
assertEquals(destinationState, CaseState.INACTIONABLE);
assertEquals(CaseState.INACTIONABLE, destinationState);
}

@Test
Expand All @@ -75,7 +75,7 @@ public void givenCaseStateActionableWhenDeactivatedThenInactionable() throws CTP
caseStateMachine.transition(actionable, CaseDTO.CaseEvent.DEACTIVATED);

// Then
assertEquals(destinationState, CaseState.INACTIONABLE);
assertEquals(CaseState.INACTIONABLE, destinationState);
}

@Test
Expand All @@ -88,7 +88,7 @@ public void givenCaseStateInactionableWhenDisabledThenInactionable() throws CTPE
caseStateMachine.transition(inactionable, CaseDTO.CaseEvent.DISABLED);

// Then
assertEquals(destinationState, CaseState.INACTIONABLE);
assertEquals(CaseState.INACTIONABLE, destinationState);
}

@Test
Expand All @@ -101,7 +101,7 @@ public void givenCaseStateInactionableWhenDeactivatedThenInactionable() throws C
caseStateMachine.transition(inactionable, CaseDTO.CaseEvent.DEACTIVATED);

// Then
assertEquals(destinationState, CaseState.INACTIONABLE);
assertEquals(CaseState.INACTIONABLE, destinationState);
}

@Test
Expand All @@ -115,7 +115,7 @@ public void givenCaseGroupStateNotStartedWhenCIDownloadedThenInProgress() throws
notStarted, CategoryDTO.CategoryName.COLLECTION_INSTRUMENT_DOWNLOADED);

// Then
assertEquals(destinationState, CaseGroupStatus.INPROGRESS);
assertEquals(CaseGroupStatus.INPROGRESS, destinationState);
}

@Test
Expand All @@ -128,7 +128,7 @@ public void givenCaseGroupStateNotStartedWhenEQLaunchThenInProgress() throws CTP
caseGroupStateMachine.transition(notStarted, CategoryDTO.CategoryName.EQ_LAUNCH);

// Then
assertEquals(destinationState, CaseGroupStatus.INPROGRESS);
assertEquals(CaseGroupStatus.INPROGRESS, destinationState);
}

@Test
Expand All @@ -143,7 +143,7 @@ public void givenCaseGroupStateNotStartedWhenSuccessfulResponseUploadedThenCompl
notStarted, CategoryDTO.CategoryName.SUCCESSFUL_RESPONSE_UPLOAD);

// Then
assertEquals(destinationState, CaseGroupStatus.COMPLETE);
assertEquals(CaseGroupStatus.COMPLETE, destinationState);
}

@Test
Expand All @@ -157,7 +157,7 @@ public void givenCaseGroupStateNotStartedWhenCompletedByPhoneThenCompletedByPhon
caseGroupStateMachine.transition(notStarted, CategoryDTO.CategoryName.COMPLETED_BY_PHONE);

// Then
assertEquals(destinationState, CaseGroupStatus.COMPLETEDBYPHONE);
assertEquals(CaseGroupStatus.COMPLETEDBYPHONE, destinationState);
}

@Test
Expand All @@ -171,7 +171,7 @@ public void givenCaseGroupStateNotStartedWhenNoLongerRequiredThenNoLongerRequire
caseGroupStateMachine.transition(notStarted, CategoryDTO.CategoryName.NO_LONGER_REQUIRED);

// Then
assertEquals(destinationState, CaseGroupStatus.NOLONGERREQUIRED);
assertEquals(CaseGroupStatus.NOLONGERREQUIRED, destinationState);
}

@Test
Expand All @@ -186,7 +186,7 @@ public void givenCaseGroupStateInProgressWhenSuccessfulResponseUploadThenComplet
inProgress, CategoryDTO.CategoryName.SUCCESSFUL_RESPONSE_UPLOAD);

// Then
assertEquals(destinationState, CaseGroupStatus.COMPLETE);
assertEquals(CaseGroupStatus.COMPLETE, destinationState);
}

@Test
Expand All @@ -200,7 +200,7 @@ public void givenCaseGroupStateInProgressWhenCompletedByPhoneThenCompletedByPhon
caseGroupStateMachine.transition(inProgress, CategoryDTO.CategoryName.COMPLETED_BY_PHONE);

// Then
assertEquals(destinationState, CaseGroupStatus.COMPLETEDBYPHONE);
assertEquals(CaseGroupStatus.COMPLETEDBYPHONE, destinationState);
}

@Test
Expand All @@ -214,7 +214,7 @@ public void givenCaseGroupStateInProgressWhenNoLongerRequiredThenNoLongerRequire
caseGroupStateMachine.transition(inProgress, CategoryDTO.CategoryName.NO_LONGER_REQUIRED);

// Then
assertEquals(destinationState, CaseGroupStatus.NOLONGERREQUIRED);
assertEquals(CaseGroupStatus.NOLONGERREQUIRED, destinationState);
}

@Test
Expand All @@ -228,7 +228,7 @@ public void givenCaseGroupStateReopenedWhenCompletedByPhoneThenCompletedByPhone(
caseGroupStateMachine.transition(reopened, CategoryDTO.CategoryName.COMPLETED_BY_PHONE);

// Then
assertEquals(destinationState, CaseGroupStatus.COMPLETEDBYPHONE);
assertEquals(CaseGroupStatus.COMPLETEDBYPHONE, destinationState);
}

@Test
Expand All @@ -242,7 +242,7 @@ public void givenCaseGroupStateReopenedWhenNoLongerRequiredThenNoLongerRequired(
caseGroupStateMachine.transition(reopened, CategoryDTO.CategoryName.NO_LONGER_REQUIRED);

// Then
assertEquals(destinationState, CaseGroupStatus.NOLONGERREQUIRED);
assertEquals(CaseGroupStatus.NOLONGERREQUIRED, destinationState);
}

// Social Outcomes
Expand Down Expand Up @@ -580,4 +580,18 @@ public void givenUnknownEligibilityWhenEqLaunchThenComplete() throws CTPExceptio
// Then
assertEquals(CaseGroupStatus.COMPLETE, destinationState);
}

@Test
public void testCaseGroupTransitionFromCompleteToNotStarted() throws CTPException {
// Given
CaseGroupStatus notStarted = CaseGroupStatus.NOTSTARTED;

// When
CaseGroupStatus destinationState =
caseGroupStateMachine.transition(
notStarted, CategoryDTO.CategoryName.OFFLINE_RESPONSE_PROCESSED);

// Then
assertEquals(CaseGroupStatus.COMPLETE, destinationState);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? I was expecting not started

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right I've fixed this

}
}
Loading