mirror of
https://github.com/google/nomulus.git
synced 2025-06-02 18:48:41 +02: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:
parent
bbe2584da4
commit
95647528b8
12 changed files with 66 additions and 75 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue