Skip to content

Commit

Permalink
increasing the length of generated strings
Browse files Browse the repository at this point in the history
some duplicate identifiers were causing test failures. They were only 5 characters long, so homing increasing this will prevent it from happening.
  • Loading branch information
daveawc committed Nov 25, 2024
1 parent ba92e7a commit 067074c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import java.util.UUID

class ApAreaEntityFactory : Factory<ApAreaEntity> {
private var id: Yielded<UUID> = { UUID.randomUUID() }
private var name: Yielded<String> = { randomStringMultiCaseWithNumbers(8) }
private var identifier: Yielded<String> = { randomStringUpperCase(5) }
private var name: Yielded<String> = { randomStringMultiCaseWithNumbers(10) }
private var identifier: Yielded<String> = { randomStringUpperCase(10) }
private var emailAddress: Yielded<String?> = { randomStringUpperCase(10) }
private var notifyReplyToEmailId: Yielded<String> = { randomStringMultiCaseWithNumbers(8) }
private var defaultCruManagementArea: Yielded<Cas1CruManagementAreaEntity> = { Cas1CruManagementAreaEntityFactory().produce() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ApprovedPremisesEntityFactory : Factory<ApprovedPremisesEntity> {
private var localAuthorityArea: Yielded<LocalAuthorityAreaEntity>? = null
private var id: Yielded<UUID> = { UUID.randomUUID() }
private var name: Yielded<String> = { randomStringMultiCaseWithNumbers(8) }
private var apCode: Yielded<String> = { randomStringUpperCase(5) }
private var apCode: Yielded<String> = { randomStringUpperCase(10) }
private var postcode: Yielded<String> = { randomPostCode() }
private var latitude: Yielded<Double> = { randomDouble(53.50, 54.99) }
private var longitude: Yielded<Double> = { randomDouble(-1.56, 1.10) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import java.util.UUID

class LocalAuthorityAreaEntityFactory : Factory<LocalAuthorityAreaEntity> {
private var id: Yielded<UUID> = { UUID.randomUUID() }
private var identifier: Yielded<String> = { randomStringUpperCase(5) }
private var name: Yielded<String> = { randomStringUpperCase(5) }
private var identifier: Yielded<String> = { randomStringUpperCase(10) }
private var name: Yielded<String> = { randomStringUpperCase(10) }

fun withName(name: String) = apply {
this.name = { name }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import java.util.UUID

class LocalAuthorityEntityFactory : Factory<LocalAuthorityAreaEntity> {
private var id: Yielded<UUID> = { UUID.randomUUID() }
private var identifier: Yielded<String> = { randomStringUpperCase(5) }
private var name: Yielded<String> = { randomStringMultiCaseWithNumbers(8) }
private var identifier: Yielded<String> = { randomStringUpperCase(10) }
private var name: Yielded<String> = { randomStringMultiCaseWithNumbers(10) }

fun withId(id: UUID) = apply {
this.id = { id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class RegistrationClientResponseFactory : Factory<Registration> {
}
private var registeringProbationArea: Yielded<RegistrationKeyValue> = {
RegistrationKeyValue(
code = randomStringUpperCase(5),
code = randomStringUpperCase(10),
description = randomStringUpperCase(20),
)
}
private var registerLevel: Yielded<RegistrationKeyValue?> = {
RegistrationKeyValue(
code = randomStringUpperCase(5),
code = randomStringUpperCase(10),
description = randomStringUpperCase(20),
)
}
Expand All @@ -66,14 +66,14 @@ class RegistrationClientResponseFactory : Factory<Registration> {
private var endDate: Yielded<LocalDate?> = { null }
private var deregisteringOfficer: Yielded<RegistrationStaffHuman?> = {
RegistrationStaffHuman(
code = randomStringUpperCase(5),
forenames = randomStringUpperCase(5),
surname = randomStringUpperCase(5),
code = randomStringUpperCase(10),
forenames = randomStringUpperCase(10),
surname = randomStringUpperCase(10),
)
}
private var deregisteringProbationArea: Yielded<RegistrationKeyValue?> = {
RegistrationKeyValue(
code = randomStringUpperCase(5),
code = randomStringUpperCase(10),
description = randomStringUpperCase(20),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class UsersTest : InitialiseDatabasePerClassTestBase() {
val email = "[email protected]"
val telephoneNumber = "123445677"
val borough = Borough(
code = randomStringMultiCaseWithNumbers(7),
code = randomStringMultiCaseWithNumbers(10),
description = randomStringMultiCaseWithNumbers(10),
)

Expand Down

0 comments on commit 067074c

Please sign in to comment.