2022-01-04 07:08:49 +01:00
|
|
|
package net.minestom.server.utils;
|
2021-11-15 19:23:20 +01:00
|
|
|
|
|
|
|
import net.minestom.server.utils.mojang.MojangUtils;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
|
|
|
public class TestMojangUtils {
|
|
|
|
@Test
|
|
|
|
public void testValidNameWorks() {
|
|
|
|
var result = MojangUtils.fromUsername("jeb_");
|
|
|
|
assertNotNull(result);
|
|
|
|
assertEquals("jeb_", result.get("name").getAsString());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testInvalidNameReturnsNull() {
|
|
|
|
var result = MojangUtils.fromUsername("jfdsa84vvcxadubasdfcvn"); // Longer than 16, always invalid
|
|
|
|
assert result == null;
|
|
|
|
}
|
|
|
|
}
|