mirror of
https://github.com/google/nomulus.git
synced 2025-06-09 05:54:55 +02:00
Conform to RDAP Technical Implementation Guide
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=251864499
This commit is contained in:
parent
5e4199fae6
commit
c3c3520e04
65 changed files with 869 additions and 709 deletions
|
@ -28,7 +28,7 @@ public class RdapSearchPatternTest {
|
|||
|
||||
@Test
|
||||
public void testNoWildcards_ok() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("example.lol", true);
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("example.lol");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("example.lol");
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isFalse();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isNull();
|
||||
|
@ -36,7 +36,7 @@ public class RdapSearchPatternTest {
|
|||
|
||||
@Test
|
||||
public void testWildcardNoTld_ok() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("exam*", true);
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("exam*");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("exam");
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isNull();
|
||||
|
@ -44,32 +44,52 @@ public class RdapSearchPatternTest {
|
|||
|
||||
@Test
|
||||
public void testWildcardTld_ok() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("exam*.lol", true);
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("exam*.lol");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("exam");
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isEqualTo("lol");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWildcardAtStart_ok() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("*.lol");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEmpty();
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isEqualTo("lol");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWildcardOnly_ok() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("*");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEmpty();
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleWildcards_unprocessable() {
|
||||
assertThrows(
|
||||
UnprocessableEntityException.class, () -> RdapSearchPattern.create("ex*am*.lol", true));
|
||||
UnprocessableEntityException.class,
|
||||
() -> RdapSearchPattern.createFromLdhDomainName("ex*am*.lol"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWildcardNotAtEnd_unprocessable() {
|
||||
assertThrows(UnprocessableEntityException.class, () -> RdapSearchPattern.create("ex*am", true));
|
||||
assertThrows(
|
||||
UnprocessableEntityException.class,
|
||||
() -> RdapSearchPattern.createFromLdhDomainName("ex*am"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWildcardNotAtEndWithTld_unprocessable() {
|
||||
assertThrows(
|
||||
UnprocessableEntityException.class, () -> RdapSearchPattern.create("ex*am.lol", true));
|
||||
UnprocessableEntityException.class,
|
||||
() -> RdapSearchPattern.createFromLdhDomainName("ex*am.lol"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShortString_ok() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("e", true);
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("e");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("e");
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isFalse();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isNull();
|
||||
|
@ -78,24 +98,45 @@ public class RdapSearchPatternTest {
|
|||
@Test
|
||||
public void testZeroLengthSuffix_unprocessable() {
|
||||
assertThrows(
|
||||
UnprocessableEntityException.class, () -> RdapSearchPattern.create("exam*.", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisallowedSuffix_unprocessable() {
|
||||
assertThrows(
|
||||
UnprocessableEntityException.class, () -> RdapSearchPattern.create("exam*.lol", false));
|
||||
UnprocessableEntityException.class,
|
||||
() -> RdapSearchPattern.createFromLdhDomainName("exam*."));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNextInitialString_alpha() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("exam*.lol", true);
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.createFromLdhDomainName("exam*.lol");
|
||||
assertThat(rdapSearchPattern.getNextInitialString()).isEqualTo("exan");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNextInitialString_unicode() {
|
||||
RdapSearchPattern rdapSearchPattern = RdapSearchPattern.create("cat.みんな", true);
|
||||
assertThat(rdapSearchPattern.getNextInitialString()).isEqualTo("cat.みんに");
|
||||
public void testNextInitialString_unicode_translatedToPunycode() {
|
||||
RdapSearchPattern rdapSearchPattern =
|
||||
RdapSearchPattern.createFromLdhOrUnicodeDomainName("cat.みんな");
|
||||
assertThat(rdapSearchPattern.getNextInitialString()).isEqualTo("cat.xn--q9jyb4d");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnicodeString_noWildcard() {
|
||||
RdapSearchPattern rdapSearchPattern =
|
||||
RdapSearchPattern.createFromUnicodeString("unicode みんに string");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("unicode みんに string");
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isFalse();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnicodeString_withWildcard() {
|
||||
RdapSearchPattern rdapSearchPattern =
|
||||
RdapSearchPattern.createFromUnicodeString("unicode みんに string*");
|
||||
assertThat(rdapSearchPattern.getInitialString()).isEqualTo("unicode みんに string");
|
||||
assertThat(rdapSearchPattern.getHasWildcard()).isTrue();
|
||||
assertThat(rdapSearchPattern.getSuffix()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnicodeString_middleWildcard() {
|
||||
assertThrows(
|
||||
UnprocessableEntityException.class,
|
||||
() -> RdapSearchPattern.createFromLdhDomainName("unicode みんに *string"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue