Automatically refactor more exception testing to use new JUnit rules

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179072309
This commit is contained in:
mcilwain 2017-12-14 11:40:04 -08:00 committed by Ben McIlwain
parent d5d29959b4
commit 9157930983
100 changed files with 3900 additions and 3192 deletions

View file

@ -14,6 +14,8 @@
package google.registry.tools;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.beust.jcommander.ParameterException;
import org.junit.Test;
@ -59,19 +61,18 @@ public class DomainCheckCommandTest extends EppToolCommandTestCase<DomainCheckCo
@Test
public void testFailure_missingClientId() throws Exception {
thrown.expect(ParameterException.class);
runCommandForced("example.tld");
assertThrows(ParameterException.class, () -> runCommandForced("example.tld"));
}
@Test
public void testFailure_NoMainParameter() throws Exception {
thrown.expect(ParameterException.class);
runCommandForced("--client=NewRegistrar");
assertThrows(ParameterException.class, () -> runCommandForced("--client=NewRegistrar"));
}
@Test
public void testFailure_unknownFlag() throws Exception {
thrown.expect(ParameterException.class);
runCommandForced("--client=NewRegistrar", "--unrecognized=foo", "example.tld");
assertThrows(
ParameterException.class,
() -> runCommandForced("--client=NewRegistrar", "--unrecognized=foo", "example.tld"));
}
}