Skip to content

Commit

Permalink
RAS-939 Survey Status Change (#289)
Browse files Browse the repository at this point in the history
* Adding new casegroup transition

* auto patch increment

* adding test for transition

* cleaning up name

* swapping asserts for consistency

* making the test change to the right state

* auto patch increment

* updating comment

* formatting

---------

Co-authored-by: ras-rm-pr-bot <rasrm.team@ons.gov.uk>
  • Loading branch information
arroyoAle and ras-rm-pr-bot authored Feb 15, 2024
1 parent d4d13dd commit 57e1145
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 20 deletions.
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(
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);
}
}

0 comments on commit 57e1145

Please sign in to comment.