package leigh.chain.pki;

import leigh.mecha.log.MechaLogger;
import leigh.mecha.log.MechaLoggerFactory;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class NameUtilsTest {
    private static final MechaLogger logger = MechaLoggerFactory.getLogger(NameUtilsTest.class);

    @Test
    public void testNameValid() {
        assertTrue(NameUtils.isValid("abc"));
        assertFalse(NameUtils.isValid(" abc"));
        assertFalse(NameUtils.isValid("abc "));
        assertFalse(NameUtils.isValid("  abc"));
        assertFalse(NameUtils.isValid(" ab   c"));
        assertFalse(NameUtils.isValid("abc.def"));
        assertTrue(NameUtils.isValid("ab-c"));
    }
}
