mirror of
https://github.com/google/nomulus.git
synced 2025-06-03 11:07:34 +02:00
Normalize expected exception handling in tests
This removes exception rules that aren't used and switches over existing uses of ExceptedException to ExceptionRule when possible. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129013329
This commit is contained in:
parent
60fc27646a
commit
9e65acc937
11 changed files with 14 additions and 29 deletions
|
@ -19,6 +19,7 @@ import static google.registry.util.ResourceUtils.readResourceUtf8;
|
|||
import static google.registry.xjc.XjcXmlTransformer.unmarshal;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import google.registry.testing.ExceptionRule;
|
||||
import google.registry.xjc.epp.XjcEpp;
|
||||
import google.registry.xjc.rde.XjcRdeDeposit;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -26,7 +27,6 @@ import org.junit.Rule;
|
|||
import org.junit.experimental.theories.DataPoints;
|
||||
import org.junit.experimental.theories.Theories;
|
||||
import org.junit.experimental.theories.Theory;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ import org.junit.runner.RunWith;
|
|||
public class XmlTestdataTest {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException thrown = ExpectedException.none();
|
||||
public final ExceptionRule thrown = new ExceptionRule();
|
||||
|
||||
private static class Example {
|
||||
final ByteArrayInputStream xmlStream;
|
||||
|
@ -151,7 +151,7 @@ public class XmlTestdataTest {
|
|||
|
||||
@Theory
|
||||
public void testInvalid(Evil v) throws Exception {
|
||||
thrown.expectMessage(v.error);
|
||||
thrown.expect(Throwable.class, v.error);
|
||||
unmarshal(XjcObject.class, v.xmlStream);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue