mirror of
https://github.com/google/nomulus.git
synced 2025-06-03 11:07:34 +02:00
Automatically refactor more exception testing to use new JUnit rules
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=178911894
This commit is contained in:
parent
36ad38e5df
commit
7dc224627f
125 changed files with 1970 additions and 1982 deletions
|
@ -15,6 +15,7 @@
|
|||
package google.registry.xjc;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.xjc.XjcXmlTransformer.unmarshal;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
|
@ -22,11 +23,9 @@ import google.registry.testing.TestDataHelper;
|
|||
import google.registry.xjc.epp.XjcEpp;
|
||||
import google.registry.xjc.rde.XjcRdeDeposit;
|
||||
import java.io.ByteArrayInputStream;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -35,10 +34,6 @@ import org.junit.runner.RunWith;
|
|||
*/
|
||||
@RunWith(Theories.class)
|
||||
public class XmlTestdataTest {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
private static class Example {
|
||||
final ByteArrayInputStream xmlStream;
|
||||
|
||||
|
@ -151,8 +146,7 @@ public class XmlTestdataTest {
|
|||
|
||||
@Theory
|
||||
public void testInvalid(Evil v) throws Exception {
|
||||
thrown.expect(Throwable.class);
|
||||
thrown.expectMessage(v.error);
|
||||
unmarshal(XjcObject.class, v.xmlStream);
|
||||
Throwable thrown = expectThrows(Throwable.class, () -> unmarshal(XjcObject.class, v.xmlStream));
|
||||
assertThat(thrown).hasMessageThat().contains(v.error);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue