Apply registrar code change after registrar schema change is taken effect (#1254)

* Apply code change after registrar schema change is taken effect
This commit is contained in:
Rachel Guan
2021-07-28 16:40:49 -04:00
committed by GitHub
parent f32d80fb9d
commit a369e57e5c
4 changed files with 97 additions and 0 deletions
@@ -29,6 +29,7 @@ import static google.registry.testing.DatabaseHelper.newRegistry;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.testing.DatabaseHelper.persistSimpleResource;
import static google.registry.testing.DatabaseHelper.persistSimpleResources;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.google.common.collect.ImmutableList;
@@ -414,6 +415,64 @@ class RegistrarTest extends EntityTestCase {
IllegalArgumentException.class, () -> new Registrar.Builder().setPhonePasscode("code1"));
}
@TestOfyAndSql
void testSuccess_getLastExpiringCertNotificationSentDate_returnsInitialValue() {
assertThat(registrar.getLastExpiringCertNotificationSentDate()).isEqualTo(START_OF_TIME);
}
@TestOfyAndSql
void testSuccess_getLastExpiringFailoverCertNotificationSentDate_returnsInitialValue() {
assertThat(registrar.getLastExpiringFailoverCertNotificationSentDate())
.isEqualTo(START_OF_TIME);
}
@TestOfyAndSql
void testSuccess_setLastExpiringCertNotificationSentDate() {
assertThat(
registrar
.asBuilder()
.setLastExpiringCertNotificationSentDate(fakeClock.nowUtc())
.build()
.getLastExpiringCertNotificationSentDate())
.isEqualTo(fakeClock.nowUtc());
}
@TestOfyAndSql
void testFailure_setLastExpiringCertNotificationSentDate_nullDate() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
() -> new Registrar.Builder().setLastExpiringCertNotificationSentDate(null).build());
assertThat(thrown)
.hasMessageThat()
.isEqualTo("Registrar lastExpiringCertNotificationSentDate cannot be null");
}
@TestOfyAndSql
void testSuccess_setLastExpiringFailoverCertNotificationSentDate() {
assertThat(
registrar
.asBuilder()
.setLastExpiringFailoverCertNotificationSentDate(fakeClock.nowUtc())
.build()
.getLastExpiringFailoverCertNotificationSentDate())
.isEqualTo(fakeClock.nowUtc());
}
@TestOfyAndSql
void testFailure_setLastExpiringFailoverCertNotificationSentDate_nullDate() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
() ->
new Registrar.Builder()
.setLastExpiringFailoverCertNotificationSentDate(null)
.build());
assertThat(thrown)
.hasMessageThat()
.isEqualTo("Registrar lastExpiringFailoverCertNotificationSentDate cannot be null");
}
@TestOfyAndSql
void testSuccess_setAllowedTlds() {
assertThat(
@@ -600,6 +600,8 @@ class google.registry.model.registrar.Registrar {
java.util.Set<java.lang.String> allowedTlds;
java.util.Set<java.lang.String> rdapBaseUrls;
org.joda.time.DateTime lastCertificateUpdateTime;
org.joda.time.DateTime lastExpiringCertNotificationSentDate;
org.joda.time.DateTime lastExpiringFailoverCertNotificationSentDate;
}
class google.registry.model.registrar.Registrar$BillingAccountEntry {
java.lang.String accountId;