mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-23 14:40:49 +08:00
Relax username length requirement and remove nickname
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.openisle.service;
|
||||
|
||||
import com.openisle.exception.FieldException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class UsernameValidatorTest {
|
||||
|
||||
@Test
|
||||
void rejectsEmptyUsername() {
|
||||
UsernameValidator validator = new UsernameValidator();
|
||||
assertThrows(FieldException.class, () -> validator.validate(""));
|
||||
assertThrows(FieldException.class, () -> validator.validate(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void allowsShortUsername() {
|
||||
UsernameValidator validator = new UsernameValidator();
|
||||
assertDoesNotThrow(() -> validator.validate("a"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user