mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 11:16:04 +02:00
Add framework for customizable WHOIS commands
With some additional changes by Ben McIlwain. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145447136
This commit is contained in:
parent
d3fe6be385
commit
bb3a0c78c5
15 changed files with 155 additions and 47 deletions
|
@ -31,13 +31,9 @@ import org.junit.runners.JUnit4;
|
|||
@RunWith(JUnit4.class)
|
||||
public class WhoisReaderTest {
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine = AppEngineRule.builder()
|
||||
.withDatastore()
|
||||
.build();
|
||||
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||
|
||||
@Rule
|
||||
public final ExceptionRule thrown = new ExceptionRule();
|
||||
@Rule public final ExceptionRule thrown = new ExceptionRule();
|
||||
|
||||
private final FakeClock clock = new FakeClock();
|
||||
|
||||
|
@ -46,9 +42,11 @@ public class WhoisReaderTest {
|
|||
createTlds("tld", "xn--kgbechtv", "1.test");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked") // XXX: Generic abuse ftw.
|
||||
@SuppressWarnings("unchecked") // XXX: Generic abuse ftw.
|
||||
<T> T readCommand(String commandStr) throws Exception {
|
||||
return (T) new WhoisReader(new StringReader(commandStr), clock.nowUtc()).readCommand();
|
||||
return (T)
|
||||
new WhoisReader(new StringReader(commandStr), new WhoisCommandFactory(), clock.nowUtc())
|
||||
.readCommand();
|
||||
}
|
||||
|
||||
void assertLoadsExampleTld(String commandString) throws Exception {
|
||||
|
@ -73,8 +71,8 @@ public class WhoisReaderTest {
|
|||
|
||||
void assertNsLookup(String commandString, String expectedIpAddress) throws Exception {
|
||||
assertThat(
|
||||
this.<NameserverLookupByIpCommand>readCommand(commandString).ipAddress.getHostAddress())
|
||||
.isEqualTo(expectedIpAddress);
|
||||
this.<NameserverLookupByIpCommand>readCommand(commandString).ipAddress.getHostAddress())
|
||||
.isEqualTo(expectedIpAddress);
|
||||
}
|
||||
|
||||
void assertLoadsRegistrar(String commandString) throws Exception {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue