mirror of
https://github.com/google/nomulus
synced 2026-09-20 06:54:43 +00:00
Clean up test "load resources" methods and classes
There is a big mix of different "load Resources" from different libraries depending on where you were and what type of resource you want. Now there is a clear hirarchy: ResourceUtils: for use in actual (non-test) code, reads a file from a context directory TestDataHelper (uses ResourceUtils): for use in tests, reads a file from a context directory + "/testdata". Also caches the resource so calling it multiple times with the same file will not read the file multiple times. Library specific helpers (e.g. ToolsTestData) (uses TestDataHelper): for use in that library's tests only, reads from a specific testdata directory. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177027533
This commit is contained in:
@@ -15,11 +15,11 @@
|
||||
package google.registry.xjc;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
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.testing.TestDataHelper;
|
||||
import google.registry.xjc.epp.XjcEpp;
|
||||
import google.registry.xjc.rde.XjcRdeDeposit;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -44,7 +44,7 @@ public class XmlTestdataTest {
|
||||
|
||||
private Example(String filename) {
|
||||
this.xmlStream = new ByteArrayInputStream(
|
||||
readResourceUtf8(XmlTestdataTest.class, "testdata/" + filename).getBytes(UTF_8));
|
||||
TestDataHelper.loadFile(XmlTestdataTest.class, filename).getBytes(UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user