blob: 26a640b0ec0ba1ac77b7a043d8690eb7b235b3e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.validation;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* @author jonmv
*/
class NameTest {
@Test
void testNames() {
Name.of("name123-_-");
Name.of("O".repeat(64));
assertThrows(IllegalArgumentException.class, () -> Name.of("0"));
assertThrows(IllegalArgumentException.class, () -> Name.of("_"));
assertThrows(IllegalArgumentException.class, () -> Name.of("-"));
assertThrows(IllegalArgumentException.class, () -> Name.of("foo."));
assertThrows(IllegalArgumentException.class, () -> Name.of("foo/"));
assertThrows(IllegalArgumentException.class, () -> Name.of("foo%"));
assertThrows(IllegalArgumentException.class, () -> Name.of("w".repeat(65)));
}
}
|