Skip to content

Commit cbcd490

Browse files
refactor: change invariant control in entities
1 parent 8598d87 commit cbcd490

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/kotlin/entity/healthprofessional/HealthProfessionalData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ object HealthProfessionalData {
3636
val role: HealthProfessionalRole
3737
) {
3838
init {
39-
require(healthProfessionalId.isNotEmpty()) {
40-
throw IllegalArgumentException("Invalid HealthProfessional ID!")
39+
check(healthProfessionalId.isNotEmpty()) {
40+
"Invalid HealthProfessional ID!"
4141
}
4242
}
4343

src/main/kotlin/entity/user/User.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ data class User(
2323
val password: String,
2424
) {
2525
init {
26-
require(userId.isNotEmpty()) {
27-
throw IllegalArgumentException("Invalid userId!")
26+
check(userId.isNotEmpty()) {
27+
"Invalid userId!"
2828
}
2929

30-
require(password.length in PASSWORD_MIN_LENGTH..PASSWORD_MAX_LENGTH) {
31-
throw IllegalArgumentException("Invalid user password!")
30+
check(password.length in PASSWORD_MIN_LENGTH..PASSWORD_MAX_LENGTH) {
31+
"Invalid user password!"
3232
}
3333
}
3434

0 commit comments

Comments
 (0)