Skip to content

Commit

Permalink
Merge branch 'PI-2391-fix-ordering-and-recall-withdrawn' of github.co…
Browse files Browse the repository at this point in the history
…m:ministryofjustice/hmpps-probation-integration-services into PI-2391-fix-ordering-and-recall-withdrawn
  • Loading branch information
pmcphee77 committed Aug 2, 2024
2 parents 508dc65 + 6ff1e80 commit 2f2b517
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,74 @@ class InterventionServiceTest {
@Test
fun `toRecallRejectedOrWithdrawn returns true `() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC05", "REC05")
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC05", "REC05")
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus)
assertEquals(true, nsi.toRecallRejectedOrWithdrawn())
}

@Test
fun `toRecallRejectedOrWithdrawn returns false due to no outcome`() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = null)
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsi =
SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = null)
assertEquals(false, nsi.toRecallRejectedOrWithdrawn())
}

@Test
fun `toRecallRejectedOrWithdrawn returns null due to other status enum`() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "OTHER", "OTHER")
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = null)
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "OTHER", "OTHER")
val nsi =
SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = null)
assertEquals(null, nsi.toRecallRejectedOrWithdrawn())
}

@Test
fun `toRecallRejectedOrWithdrawn returns true due to outcome type enum`() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val outcome = ReferenceData("REC02", "REC02", IdGenerator.getAndIncrement())
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = outcome)
val nsi = SentenceGenerator.generateBreachNsi(
SentenceGenerator.CURRENT_SENTENCE,
status = nsiStatus,
outcome = outcome
)
assertEquals(true, nsi.toRecallRejectedOrWithdrawn())
}

@Test
fun `toOutcome returns null due to null outcome`() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = null)
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsi =
SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = null)
assertEquals(null, nsi.toOutcomeRecall())
}

@Test
fun `toOutcome returns false due to outcome type`() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val outcome = ReferenceData("REC02", "REC02", IdGenerator.getAndIncrement())
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = outcome)
val nsi = SentenceGenerator.generateBreachNsi(
SentenceGenerator.CURRENT_SENTENCE,
status = nsiStatus,
outcome = outcome
)
assertEquals(false, nsi.toOutcomeRecall())
}

@Test
fun `toOutcome returns true due to outcome type`() {

val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val nsiStatus = NsiStatus(IdGenerator.getAndIncrement(), "REC03", "REC03")
val outcome = ReferenceData("REC03", "REC03", IdGenerator.getAndIncrement())
val nsi = SentenceGenerator.generateBreachNsi(SentenceGenerator.CURRENT_SENTENCE, status = nsiStatus, outcome = outcome)
val nsi = SentenceGenerator.generateBreachNsi(
SentenceGenerator.CURRENT_SENTENCE,
status = nsiStatus,
outcome = outcome
)
assertEquals(true, nsi.toOutcomeRecall())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
4 changes: 2 additions & 2 deletions projects/prison-education-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
4 changes: 2 additions & 2 deletions projects/prison-identifier-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
4 changes: 2 additions & 2 deletions projects/prisoner-profile-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
4 changes: 2 additions & 2 deletions projects/probation-search-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
4 changes: 2 additions & 2 deletions projects/refer-and-monitor-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand Down

0 comments on commit 2f2b517

Please sign in to comment.