mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02: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:
parent
2ffc3d539b
commit
cf849bc073
2 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue