mirror of
https://github.com/google/nomulus
synced 2026-05-28 10:40:44 +00:00
Fix XmlTestUtilsTest in open source build
The ExpectedException @Rule does not appear to be be able to catch AssertionError in the version of JUnit we're tracking in the open source world. This caused the expected exceptions to get passed through and treated as failures. The solution is to just use our forked version of ExpectedException, which is ExceptionRule. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=128988393
This commit is contained in:
@@ -23,6 +23,7 @@ java_library(
|
||||
"//third_party/java/truth",
|
||||
"//java/google/registry/util",
|
||||
"//java/google/registry/xml",
|
||||
"//javatests/google/registry/testing",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ package google.registry.xml;
|
||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static google.registry.xml.XmlTestUtils.assertXmlEquals;
|
||||
|
||||
import google.registry.testing.ExceptionRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.junit.runners.JUnit4;
|
||||
public class XmlTestUtilsTest {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException thrown = ExpectedException.none();
|
||||
public final ExceptionRule thrown = new ExceptionRule();
|
||||
|
||||
void runTest(String file1, String file2) throws Exception {
|
||||
String s1 = readResourceUtf8(getClass(), "testdata/" + file1);
|
||||
@@ -46,12 +46,12 @@ public class XmlTestUtilsTest {
|
||||
thrown.expect(AssertionError.class);
|
||||
runTest("simple.xml", "twoextensions_feeThenLaunch.xml");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMultipleElementsInDifferentNamespaces() throws Exception {
|
||||
runTest("twoextensions_feeThenLaunch.xml", "twoextensions_launchThenFee.xml");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMultipleElementsInDifferentNamespaces_differentValues() throws Exception {
|
||||
thrown.expect(AssertionError.class);
|
||||
|
||||
Reference in New Issue
Block a user