diff --git a/core/src/main/java/google/registry/tools/SetDatabaseTransitionScheduleCommand.java b/core/src/main/java/google/registry/tools/SetDatabaseTransitionScheduleCommand.java index 508a03d0e..0885cf461 100644 --- a/core/src/main/java/google/registry/tools/SetDatabaseTransitionScheduleCommand.java +++ b/core/src/main/java/google/registry/tools/SetDatabaseTransitionScheduleCommand.java @@ -43,6 +43,7 @@ public class SetDatabaseTransitionScheduleCommand extends MutatingCommand { @Parameter( names = "--transition_id", + required = true, description = "Transition id string for the schedule being updated") private TransitionId transitionId; diff --git a/core/src/test/java/google/registry/tools/SetDatabaseTransitionScheduleCommandTest.java b/core/src/test/java/google/registry/tools/SetDatabaseTransitionScheduleCommandTest.java index 9e847c314..b52a465ba 100644 --- a/core/src/test/java/google/registry/tools/SetDatabaseTransitionScheduleCommandTest.java +++ b/core/src/test/java/google/registry/tools/SetDatabaseTransitionScheduleCommandTest.java @@ -20,7 +20,9 @@ import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm; import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.util.DateTimeUtils.START_OF_TIME; +import static org.junit.jupiter.api.Assertions.assertThrows; +import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableSortedMap; import com.googlecode.objectify.Key; import google.registry.model.common.DatabaseTransitionSchedule; @@ -45,6 +47,15 @@ public class SetDatabaseTransitionScheduleCommandTest fakeClock.setTo(DateTime.parse("2020-12-01T00:00:00Z")); } + @Test + void testFailure_noTransitionId() throws Exception { + ParameterException thrown = + assertThrows( + ParameterException.class, + () -> runCommandForced("--transition_schedule=2021-04-14T00:00:00.000Z=DATASTORE")); + assertThat(thrown).hasMessageThat().contains("--transition_id"); + } + @Test void testSuccess_currentScheduleIsEmpty() throws Exception { assertThat(ofy().load().key(key).now()).isNull();