generated from ministryofjustice/hmpps-template-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce duplication in tests for creating Sentences
Introduce helper function with defaults that allows tests to only specify interesting fields to be asserted on. Disable test that used to convert nDelius sentence length to terms, we will take a different approach in a following PR.
- Loading branch information
1 parent
c1ce935
commit 73977e4
Showing
6 changed files
with
111 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/helpers/SentenceHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.helpers | ||
|
||
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.Sentence | ||
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.Term as IntegrationApiTerm | ||
import java.time.LocalDate | ||
|
||
fun generateTestSentence( | ||
dateOfSentencing: LocalDate? = null, | ||
description: String? = "Some description", | ||
isActive: Boolean? = true, | ||
isCustodial: Boolean = true, | ||
terms: List<IntegrationApiTerm> = listOf( | ||
IntegrationApiTerm(hours = 2), | ||
IntegrationApiTerm(years = 25), | ||
), | ||
): Sentence = Sentence( | ||
dateOfSentencing = dateOfSentencing, | ||
description = description, | ||
isActive = isActive, | ||
isCustodial = isCustodial, | ||
terms = terms, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.