Move tests to use TestDataHelper for reading resources

TestDataHelper is build exactly to prevent direct reads of resources. It caches
the resources and makes sure they are in the correct directory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191785004
This commit is contained in:
guyben 2018-04-05 13:01:59 -07:00 committed by Ben McIlwain
parent e5c0a85b3b
commit 6699915132
16 changed files with 70 additions and 78 deletions

View file

@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.ResourceUtils.readResourceUtf8;
import static google.registry.testing.TestDataHelper.loadFile;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableList;
@ -56,15 +56,13 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
DomainApplication domainApplication;
private static final String ACTIVE_SMD =
readResourceUtf8(UpdateSmdCommandTest.class, "testdata/Court-Agent-English-Active.smd");
loadFile(UpdateSmdCommandTest.class, "Court-Agent-English-Active.smd");
private static final String DIFFERENT_LABEL_SMD =
readResourceUtf8(UpdateSmdCommandTest.class, "testdata/Court-Agent-Chinese-Active.smd");
loadFile(UpdateSmdCommandTest.class, "Court-Agent-Chinese-Active.smd");
private static final String INVALID_SMD =
readResourceUtf8(UpdateSmdCommandTest.class,
"testdata/InvalidSignature-Trademark-Agent-English-Active.smd");
loadFile(UpdateSmdCommandTest.class, "InvalidSignature-Trademark-Agent-English-Active.smd");
private static final String REVOKED_TMV_SMD =
readResourceUtf8(UpdateSmdCommandTest.class,
"testdata/TMVRevoked-Trademark-Agent-English-Active.smd");
loadFile(UpdateSmdCommandTest.class, "TMVRevoked-Trademark-Agent-English-Active.smd");
// The test data was created by ICANN on 2013. It includes SMDs that expire sometime during 2017.
// We want the "current date" to be sometime between 2013 and 2017.