mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 11:38:35 +02:00
Validate provided email addresses when creating a Registrar
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=240574585
This commit is contained in:
parent
26eda15d47
commit
174d8d69ea
10 changed files with 137 additions and 24 deletions
|
@ -367,4 +367,26 @@ public class RegistrarContactCommandTest extends CommandTestCase<RegistrarContac
|
|||
"--mode=CREATE", "--name=Jim Doe", "--email=jim.doe@example.com", "NewRegistrar");
|
||||
assertThat(loadRegistrar("NewRegistrar").getContactsRequireSyncing()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate_failure_badEmail() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--mode=CREATE", "--name=Jim Doe", "--email=lolcat", "NewRegistrar"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.isEqualTo("Provided email lolcat is not a valid email address");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate_failure_nullEmail() {
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--mode=CREATE", "--name=Jim Doe", "NewRegistrar"));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("--email is required when --mode=CREATE");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue