1
1
package uk.gov.justice.digital.hmpps.data.generator
2
2
3
3
import uk.gov.justice.digital.hmpps.api.model.DocumentType
4
+ import uk.gov.justice.digital.hmpps.data.generator.AreaGenerator.PARTITION_AREA
5
+ import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.DEFAULT_ADDRESS_STATUS
6
+ import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.DEFAULT_ADDRESS_TYPE
7
+ import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.DEFAULT_ALLOCATION_REASON
8
+ import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.DEFAULT_TIER
4
9
import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.DISABILITY_CONDITION_1
5
10
import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.DISABILITY_TYPE_1
6
11
import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.ETHNICITY
@@ -20,7 +25,7 @@ import java.time.LocalDate
20
25
import java.time.ZonedDateTime
21
26
22
27
object PersonGenerator {
23
- val PARTITION_AREA = PartitionArea ( IdGenerator .getAndIncrement(), " Partition Area " )
28
+
24
29
val NEW_TO_PROBATION = generate(" N123456" )
25
30
val CURRENTLY_MANAGED = generate(" C123456" , currentDisposal = true )
26
31
val PREVIOUSLY_MANAGED = generate(" P123456" )
@@ -35,6 +40,9 @@ object PersonGenerator {
35
40
null
36
41
)
37
42
43
+ val ADDRESS = generateAddress(CURRENTLY_MANAGED .id, false )
44
+ val ALIAS = generatePersonAlias(CURRENTLY_MANAGED )
45
+
38
46
fun generate (
39
47
crn : String ,
40
48
softDeleted : Boolean = false,
@@ -81,17 +89,41 @@ object PersonGenerator {
81
89
immigrationNumber = " IMA123" ,
82
90
mostRecentPrisonerNumber = " PRS123" ,
83
91
previousSurname = " Previous" ,
84
- title = TITLE
92
+ title = TITLE ,
93
+ offenderManagers = emptyList(),
94
+ restrictionMessage = " restrictionMessage" ,
95
+ exclusionMessage = " exclusionMessage" ,
96
+ currentTier = DEFAULT_TIER
85
97
)
86
98
87
99
fun generatePersonManager (person : Person ) =
88
100
PersonManager (
89
- IdGenerator .getAndIncrement(),
90
- person,
91
- TeamGenerator .DEFAULT ,
92
- StaffGenerator .ALLOCATED ,
93
- ProviderGenerator .DEFAULT ,
94
- ZonedDateTime .now()
101
+ id = IdGenerator .getAndIncrement(),
102
+ trustProviderFlag = false ,
103
+ person = person,
104
+ team = TeamGenerator .DEFAULT ,
105
+ staff = StaffGenerator .ALLOCATED ,
106
+ provider = ProviderGenerator .DEFAULT ,
107
+ date = ZonedDateTime .now(),
108
+ allocationReason = DEFAULT_ALLOCATION_REASON ,
109
+ officer = StaffGenerator .OFFICER ,
110
+ partitionArea = PARTITION_AREA ,
111
+ startDate = LocalDate .now().minusDays(2 ),
112
+ staffEmployeeId = StaffGenerator .ALLOCATED .id,
113
+ providerEmployee = ProviderEmployeeGenerator .PROVIDER_EMPLOYEE
114
+ )
115
+
116
+ fun generatePersonAlias (person : Person ) =
117
+ OffenderAlias (
118
+ aliasID = IdGenerator .getAndIncrement(),
119
+ personId = person.id,
120
+ dateOfBirth = LocalDate .of(1968 , 1 , 1 ),
121
+ firstName = " Bob" ,
122
+ secondName = " Reg" ,
123
+ thirdName = " Xavier" ,
124
+ surname = " Potts" ,
125
+ gender = GENDER_MALE ,
126
+ softDeleted = false
95
127
)
96
128
97
129
fun generateProvision (personId : Long , end : LocalDate ? ) = Provision (
@@ -115,4 +147,25 @@ object PersonGenerator {
115
147
notes = null ,
116
148
finishDate = end,
117
149
)
150
+
151
+ fun generateAddress (personId : Long , softDeleted : Boolean ) = PersonAddress (
152
+ id = IdGenerator .getAndIncrement(),
153
+ personId = personId,
154
+ type = DEFAULT_ADDRESS_TYPE ,
155
+ status = DEFAULT_ADDRESS_STATUS ,
156
+ streetName = " A Street" ,
157
+ town = " A town" ,
158
+ county = " A county" ,
159
+ postcode = " NE209XL" ,
160
+ telephoneNumber = " 089876765" ,
161
+ buildingName = " The building" ,
162
+ district = " A District" ,
163
+ addressNumber = " 20" ,
164
+ noFixedAbode = false ,
165
+ typeVerified = true ,
166
+ startDate = LocalDate .now().minusDays(1 ),
167
+ endDate = null ,
168
+ softDeleted = false ,
169
+ createdDatetime = ZonedDateTime .now().minusDays(1 ),
170
+ )
118
171
}
0 commit comments