Rely less on local variables in UpdateRegistrarCommandTest

Reloading the entities under test every time is more resilient to
coding errors than trying to ensure that a local variable is kept up
to date.  It also reduces total LoC in the test file.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117842135
This commit is contained in:
mcilwain 2016-03-22 11:12:06 -07:00 committed by Justine Tunney
parent 62ca799b36
commit 85911e0b95

View file

@ -44,94 +44,88 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
@Test @Test
public void testSuccess_password() throws Exception { public void testSuccess_password() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").testPassword("some_password")).isFalse();
assertThat(registrar.testPassword("some_password")).isFalse();
runCommand("--password=some_password", "--force", "NewRegistrar"); runCommand("--password=some_password", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").testPassword("some_password")).isTrue();
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.testPassword("some_password")).isTrue();
} }
@Test @Test
public void testSuccess_registrarType() throws Exception { public void testSuccess_registrarType() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(
registrar = persistResource( loadByClientId("NewRegistrar")
registrar.asBuilder().setType(Registrar.Type.OTE).setIanaIdentifier(null).build()); .asBuilder()
assertThat(registrar.getType()).isEqualTo(Type.OTE); .setType(Registrar.Type.OTE)
.setIanaIdentifier(null)
.build());
assertThat(loadByClientId("NewRegistrar").getType()).isEqualTo(Type.OTE);
runCommand("--registrar_type=TEST", "--force", "NewRegistrar"); runCommand("--registrar_type=TEST", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getType()).isEqualTo(Type.TEST);
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getType()).isEqualTo(Type.TEST);
} }
@Test @Test
public void testFailure_noPasscodeOnChangeToReal() throws Exception { public void testFailure_noPasscodeOnChangeToReal() throws Exception {
thrown.expect(IllegalArgumentException.class, "--passcode is required for REAL registrars."); thrown.expect(IllegalArgumentException.class, "--passcode is required for REAL registrars.");
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(
registrar = persistResource(registrar.asBuilder() loadByClientId("NewRegistrar")
.setType(Registrar.Type.OTE) .asBuilder()
.setIanaIdentifier(null) .setType(Registrar.Type.OTE)
.setPhonePasscode(null) .setIanaIdentifier(null)
.build()); .setPhonePasscode(null)
.build());
runCommand("--registrar_type=REAL", "--iana_id=1000", "--force", "NewRegistrar"); runCommand("--registrar_type=REAL", "--iana_id=1000", "--force", "NewRegistrar");
} }
@Test @Test
public void testSuccess_registrarState() throws Exception { public void testSuccess_registrarState() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getState()).isEqualTo(State.ACTIVE);
assertThat(registrar.getState()).isEqualTo(State.ACTIVE);
runCommand("--registrar_state=SUSPENDED", "--force", "NewRegistrar"); runCommand("--registrar_state=SUSPENDED", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getState()).isEqualTo(State.SUSPENDED);
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getState()).isEqualTo(State.SUSPENDED);
} }
@Test @Test
public void testSuccess_allowedTlds() throws Exception { public void testSuccess_allowedTlds() throws Exception {
createTlds("xn--q9jyb4c", "foobar"); createTlds("xn--q9jyb4c", "foobar");
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(
registrar = persistResource( loadByClientId("NewRegistrar")
registrar.asBuilder().setAllowedTlds(ImmutableSet.of("xn--q9jyb4c")).build()); .asBuilder()
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
.build());
runCommand("--allowed_tlds=xn--q9jyb4c,foobar", "--force", "NewRegistrar"); runCommand("--allowed_tlds=xn--q9jyb4c,foobar", "--force", "NewRegistrar");
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getAllowedTlds())
assertThat(registrar.getAllowedTlds()).containsExactly("xn--q9jyb4c", "foobar"); .containsExactly("xn--q9jyb4c", "foobar");
} }
@Test @Test
public void testSuccess_addAllowedTlds() throws Exception { public void testSuccess_addAllowedTlds() throws Exception {
createTlds("xn--q9jyb4c", "foo", "bar"); createTlds("xn--q9jyb4c", "foo", "bar");
Registrar registrar = Registrar.loadByClientId("NewRegistrar"); persistResource(
registrar = persistResource( loadByClientId("NewRegistrar")
registrar.asBuilder().setAllowedTlds(ImmutableSet.of("xn--q9jyb4c")).build()); .asBuilder()
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
.build());
runCommand("--add_allowed_tlds=foo,bar", "--force", "NewRegistrar"); runCommand("--add_allowed_tlds=foo,bar", "--force", "NewRegistrar");
registrar = Registrar.loadByClientId("NewRegistrar"); assertThat(loadByClientId("NewRegistrar").getAllowedTlds())
assertThat(registrar.getAllowedTlds()).containsExactly("xn--q9jyb4c", "foo", "bar"); .containsExactly("xn--q9jyb4c", "foo", "bar");
} }
@Test @Test
public void testSuccess_addAllowedTldsWithDupes() throws Exception { public void testSuccess_addAllowedTldsWithDupes() throws Exception {
createTlds("xn--q9jyb4c", "foo", "bar"); createTlds("xn--q9jyb4c", "foo", "bar");
Registrar registrar = Registrar.loadByClientId("NewRegistrar"); persistResource(
registrar = persistResource( loadByClientId("NewRegistrar")
registrar.asBuilder().setAllowedTlds(ImmutableSet.of("xn--q9jyb4c")).build()); .asBuilder()
.setAllowedTlds(ImmutableSet.of("xn--q9jyb4c"))
.build());
runCommand("--add_allowed_tlds=xn--q9jyb4c,foo,bar", "--force", "NewRegistrar"); runCommand("--add_allowed_tlds=xn--q9jyb4c,foo,bar", "--force", "NewRegistrar");
registrar = Registrar.loadByClientId("NewRegistrar"); assertThat(loadByClientId("NewRegistrar").getAllowedTlds())
assertThat(registrar.getAllowedTlds()).isEqualTo(ImmutableSet.of("xn--q9jyb4c", "foo", "bar")); .isEqualTo(ImmutableSet.of("xn--q9jyb4c", "foo", "bar"));
} }
@Test @Test
public void testSuccess_ipWhitelist() throws Exception { public void testSuccess_ipWhitelist() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getIpAddressWhitelist()).isEmpty();
assertThat(registrar.getIpAddressWhitelist()).isEmpty();
runCommand("--ip_whitelist=192.168.1.1,192.168.0.2/16", "--force", "NewRegistrar"); runCommand("--ip_whitelist=192.168.1.1,192.168.0.2/16", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getIpAddressWhitelist())
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getIpAddressWhitelist())
.containsExactly( .containsExactly(
CidrAddressBlock.create("192.168.1.1"), CidrAddressBlock.create("192.168.0.2/16")) CidrAddressBlock.create("192.168.1.1"), CidrAddressBlock.create("192.168.0.2/16"))
.inOrder(); .inOrder();
@ -139,29 +133,26 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
@Test @Test
public void testSuccess_clearIpWhitelist() throws Exception { public void testSuccess_clearIpWhitelist() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(
persistResource(registrar.asBuilder() loadByClientId("NewRegistrar")
.setIpAddressWhitelist(ImmutableList.of( .asBuilder()
CidrAddressBlock.create("192.168.1.1"), CidrAddressBlock.create("192.168.0.2/16"))) .setIpAddressWhitelist(
.build()); ImmutableList.of(
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); CidrAddressBlock.create("192.168.1.1"),
assertThat(registrar.getIpAddressWhitelist()).isNotEmpty(); CidrAddressBlock.create("192.168.0.2/16")))
.build());
assertThat(loadByClientId("NewRegistrar").getIpAddressWhitelist()).isNotEmpty();
runCommand("--ip_whitelist=null", "--force", "NewRegistrar"); runCommand("--ip_whitelist=null", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getIpAddressWhitelist()).isEmpty();
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getIpAddressWhitelist()).isEmpty();
} }
@Test @Test
public void testSuccess_certFile() throws Exception { public void testSuccess_certFile() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); Registrar registrar = checkNotNull(loadByClientId("NewRegistrar"));
assertThat(registrar.getClientCertificate()).isNull(); assertThat(registrar.getClientCertificate()).isNull();
assertThat(registrar.getClientCertificateHash()).isNull(); assertThat(registrar.getClientCertificateHash()).isNull();
runCommand("--cert_file=" + getCertFilename(), "--force", "NewRegistrar"); runCommand("--cert_file=" + getCertFilename(), "--force", "NewRegistrar");
registrar = checkNotNull(loadByClientId("NewRegistrar"));
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
// NB: Hash was computed manually using 'openssl x509 -fingerprint -sha256 -in ...' and then // NB: Hash was computed manually using 'openssl x509 -fingerprint -sha256 -in ...' and then
// converting the result from a hex string to non-padded base64 encoded string. // converting the result from a hex string to non-padded base64 encoded string.
assertThat(registrar.getClientCertificate()).isEqualTo(SAMPLE_CERT); assertThat(registrar.getClientCertificate()).isEqualTo(SAMPLE_CERT);
@ -170,80 +161,63 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
@Test @Test
public void testSuccess_certHash() throws Exception { public void testSuccess_certHash() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getClientCertificateHash()).isNull();
assertThat(registrar.getClientCertificateHash()).isNull();
runCommand("--cert_hash=" + SAMPLE_CERT_HASH, "--force", "NewRegistrar"); runCommand("--cert_hash=" + SAMPLE_CERT_HASH, "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getClientCertificateHash())
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); .isEqualTo(SAMPLE_CERT_HASH);
assertThat(registrar.getClientCertificateHash()).isEqualTo(SAMPLE_CERT_HASH);
} }
@Test @Test
public void testSuccess_clearCert() throws Exception { public void testSuccess_clearCert() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
persistResource( persistResource(
registrar.asBuilder().setClientCertificate(SAMPLE_CERT, DateTime.now(UTC)).build()); loadByClientId("NewRegistrar")
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); .asBuilder()
assertThat(isNullOrEmpty(registrar.getClientCertificate())).isFalse(); .setClientCertificate(SAMPLE_CERT, DateTime.now(UTC))
.build());
assertThat(isNullOrEmpty(loadByClientId("NewRegistrar").getClientCertificate())).isFalse();
runCommand("--cert_file=/dev/null", "--force", "NewRegistrar"); runCommand("--cert_file=/dev/null", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getClientCertificate()).isNull();
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getClientCertificate()).isNull();
} }
@Test @Test
public void testSuccess_clearCertHash() throws Exception { public void testSuccess_clearCertHash() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(
persistResource(registrar.asBuilder().setClientCertificateHash(SAMPLE_CERT_HASH).build()); loadByClientId("NewRegistrar")
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); .asBuilder()
assertThat(isNullOrEmpty(registrar.getClientCertificateHash())).isFalse(); .setClientCertificateHash(SAMPLE_CERT_HASH)
.build());
assertThat(isNullOrEmpty(loadByClientId("NewRegistrar").getClientCertificateHash())).isFalse();
runCommand("--cert_hash=null", "--force", "NewRegistrar"); runCommand("--cert_hash=null", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getClientCertificateHash()).isNull();
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getClientCertificateHash()).isNull();
} }
@Test @Test
public void testSuccess_ianaId() throws Exception { public void testSuccess_ianaId() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getIanaIdentifier()).isEqualTo(8);
assertThat(registrar.getIanaIdentifier()).isEqualTo(8);
runCommand("--iana_id=12345", "--force", "NewRegistrar"); runCommand("--iana_id=12345", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getIanaIdentifier()).isEqualTo(12345);
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getIanaIdentifier()).isEqualTo(12345);
} }
@Test @Test
public void testSuccess_billingId() throws Exception { public void testSuccess_billingId() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getBillingIdentifier()).isNull();
assertThat(registrar.getBillingIdentifier()).isNull();
runCommand("--billing_id=12345", "--force", "NewRegistrar"); runCommand("--billing_id=12345", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getBillingIdentifier()).isEqualTo(12345);
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getBillingIdentifier()).isEqualTo(12345);
} }
@Test @Test
public void testSuccess_changeBillingMethodToBraintreeWhenBalanceIsZero() throws Exception { public void testSuccess_changeBillingMethodToBraintreeWhenBalanceIsZero() throws Exception {
createTlds("xn--q9jyb4c"); createTlds("xn--q9jyb4c");
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getBillingMethod()).isEqualTo(BillingMethod.EXTERNAL);
assertThat(registrar.getBillingMethod()).isEqualTo(BillingMethod.EXTERNAL);
runCommand("--billing_method=braintree", "--force", "NewRegistrar"); runCommand("--billing_method=braintree", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getBillingMethod())
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); .isEqualTo(BillingMethod.BRAINTREE);
assertThat(registrar.getBillingMethod()).isEqualTo(BillingMethod.BRAINTREE);
} }
@Test @Test
public void testFailure_changeBillingMethodWhenBalanceIsNonZero() throws Exception { public void testFailure_changeBillingMethodWhenBalanceIsNonZero() throws Exception {
createTlds("xn--q9jyb4c"); createTlds("xn--q9jyb4c");
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); Registrar registrar = checkNotNull(loadByClientId("NewRegistrar"));
persistResource( persistResource(
new RegistrarBillingEntry.Builder() new RegistrarBillingEntry.Builder()
.setPrevious(null) .setPrevious(null)
@ -264,7 +238,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
runCommand("--street=\"1234 Main St\"", "--street \"4th Floor\"", "--street \"Suite 1\"", runCommand("--street=\"1234 Main St\"", "--street \"4th Floor\"", "--street \"Suite 1\"",
"--city Brooklyn", "--state NY", "--zip 11223", "--cc US", "--force", "NewRegistrar"); "--city Brooklyn", "--state NY", "--zip 11223", "--cc US", "--force", "NewRegistrar");
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); Registrar registrar = checkNotNull(loadByClientId("NewRegistrar"));
assertThat(registrar.getLocalizedAddress() != null).isTrue(); assertThat(registrar.getLocalizedAddress() != null).isTrue();
assertThat(registrar.getLocalizedAddress().getStreet()).hasSize(3); assertThat(registrar.getLocalizedAddress().getStreet()).hasSize(3);
assertThat(registrar.getLocalizedAddress().getStreet().get(0)).isEqualTo("1234 Main St"); assertThat(registrar.getLocalizedAddress().getStreet().get(0)).isEqualTo("1234 Main St");
@ -278,53 +252,39 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
@Test @Test
public void testSuccess_blockPremiumNames() throws Exception { public void testSuccess_blockPremiumNames() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getBlockPremiumNames()).isFalse();
assertThat(registrar.getBlockPremiumNames()).isFalse();
runCommand("--block_premium=true", "--force", "NewRegistrar"); runCommand("--block_premium=true", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getBlockPremiumNames()).isTrue();
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getBlockPremiumNames()).isTrue();
} }
@Test @Test
public void testSuccess_resetBlockPremiumNames() throws Exception { public void testSuccess_resetBlockPremiumNames() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(loadByClientId("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
persistResource(registrar.asBuilder().setBlockPremiumNames(true).build());
runCommand("--block_premium=false", "--force", "NewRegistrar"); runCommand("--block_premium=false", "--force", "NewRegistrar");
assertThat(loadByClientId("NewRegistrar").getBlockPremiumNames()).isFalse();
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar"));
assertThat(registrar.getBlockPremiumNames()).isFalse();
} }
@Test @Test
public void testSuccess_blockPremiumNamesUnspecified() throws Exception { public void testSuccess_blockPremiumNamesUnspecified() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); persistResource(loadByClientId("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
persistResource(registrar.asBuilder().setBlockPremiumNames(true).build());
// Make some unrelated change where we don't specify "--block_premium". // Make some unrelated change where we don't specify "--block_premium".
runCommand("--billing_id=12345", "--force", "NewRegistrar"); runCommand("--billing_id=12345", "--force", "NewRegistrar");
// Make sure the field didn't get reset back to false. // Make sure the field didn't get reset back to false.
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); assertThat(loadByClientId("NewRegistrar").getBlockPremiumNames()).isTrue();
assertThat(registrar.getBlockPremiumNames()).isTrue();
} }
@Test @Test
public void testSuccess_updateMultiple() throws Exception { public void testSuccess_updateMultiple() throws Exception {
assertThat(Registrar.loadByClientId("TheRegistrar").getState()).isEqualTo(State.ACTIVE); assertThat(loadByClientId("TheRegistrar").getState()).isEqualTo(State.ACTIVE);
assertThat(Registrar.loadByClientId("NewRegistrar").getState()).isEqualTo(State.ACTIVE); assertThat(loadByClientId("NewRegistrar").getState()).isEqualTo(State.ACTIVE);
runCommand("--registrar_state=SUSPENDED", "--force", "TheRegistrar", "NewRegistrar"); runCommand("--registrar_state=SUSPENDED", "--force", "TheRegistrar", "NewRegistrar");
assertThat(loadByClientId("TheRegistrar").getState()).isEqualTo(State.SUSPENDED);
assertThat(Registrar.loadByClientId("TheRegistrar").getState()).isEqualTo(State.SUSPENDED); assertThat(loadByClientId("NewRegistrar").getState()).isEqualTo(State.SUSPENDED);
assertThat(Registrar.loadByClientId("NewRegistrar").getState()).isEqualTo(State.SUSPENDED);
} }
@Test @Test
public void testSuccess_resetOptionalParamsNullString() throws Exception { public void testSuccess_resetOptionalParamsNullString() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); Registrar registrar = checkNotNull(loadByClientId("NewRegistrar"));
registrar = persistResource(registrar.asBuilder() registrar = persistResource(registrar.asBuilder()
.setType(Type.PDT) // for non-null IANA ID .setType(Type.PDT) // for non-null IANA ID
.setIanaIdentifier(9995L) .setIanaIdentifier(9995L)
@ -356,7 +316,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
"--force", "--force",
"NewRegistrar"); "NewRegistrar");
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); registrar = checkNotNull(loadByClientId("NewRegistrar"));
assertThat(registrar.getIanaIdentifier()).isNull(); assertThat(registrar.getIanaIdentifier()).isNull();
assertThat(registrar.getBillingIdentifier()).isNull(); assertThat(registrar.getBillingIdentifier()).isNull();
assertThat(registrar.getPhoneNumber()).isNull(); assertThat(registrar.getPhoneNumber()).isNull();
@ -368,7 +328,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
@Test @Test
public void testSuccess_resetOptionalParamsEmptyString() throws Exception { public void testSuccess_resetOptionalParamsEmptyString() throws Exception {
Registrar registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); Registrar registrar = checkNotNull(loadByClientId("NewRegistrar"));
registrar = persistResource(registrar.asBuilder() registrar = persistResource(registrar.asBuilder()
.setType(Type.PDT) // for non-null IANA ID .setType(Type.PDT) // for non-null IANA ID
.setIanaIdentifier(9995L) .setIanaIdentifier(9995L)
@ -400,7 +360,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
"--force", "--force",
"NewRegistrar"); "NewRegistrar");
registrar = checkNotNull(Registrar.loadByClientId("NewRegistrar")); registrar = checkNotNull(loadByClientId("NewRegistrar"));
assertThat(registrar.getIanaIdentifier()).isNull(); assertThat(registrar.getIanaIdentifier()).isNull();
assertThat(registrar.getBillingIdentifier()).isNull(); assertThat(registrar.getBillingIdentifier()).isNull();
assertThat(registrar.getPhoneNumber()).isNull(); assertThat(registrar.getPhoneNumber()).isNull();
@ -413,8 +373,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
@Test @Test
public void testSuccess_setWhoisServer_works() throws Exception { public void testSuccess_setWhoisServer_works() throws Exception {
runCommand("--whois=whois.goth.black", "--force", "NewRegistrar"); runCommand("--whois=whois.goth.black", "--force", "NewRegistrar");
assertThat(Registrar.loadByClientId("NewRegistrar").getWhoisServer()) assertThat(loadByClientId("NewRegistrar").getWhoisServer()).isEqualTo("whois.goth.black");
.isEqualTo("whois.goth.black");
} }
@Test @Test