feat: added min size of 12 to validation of characterConfig
This commit is contained in:
parent
bf2ef23733
commit
b9a6308d6b
@ -3,6 +3,7 @@ package uulm.teamname.marvelous.gamelibrary.config;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -13,6 +14,7 @@ public class CharacterConfig {
|
||||
|
||||
@NotEmpty
|
||||
@Valid
|
||||
@Size(min = 12, message = "has less than 12 characters")
|
||||
public CharacterProperties[] characters;
|
||||
|
||||
@JsonIgnore private Map<String, CharacterProperties> propertyMap;
|
||||
|
@ -125,7 +125,8 @@ class MessageValidationUtilityTest {
|
||||
characterConfig.characters = new CharacterProperties[] {racoon, quicksilver, hulk, loki, silversurfer};
|
||||
|
||||
assertThat(ValidationUtility.validate(characterConfig).get())
|
||||
.contains("characters[4].rangedDamage must be greater than 0",
|
||||
.contains("characters has less than 12 characters",
|
||||
"characters[4].rangedDamage must be greater than 0",
|
||||
"characters[4].name must not be empty",
|
||||
"characters[4].meleeDamage must be greater than 0");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user