mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 12:08:36 +02:00
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:
parent
e5c0a85b3b
commit
6699915132
16 changed files with 70 additions and 78 deletions
|
@ -74,4 +74,12 @@ public final class TestDataHelper {
|
|||
FileKey.create(context, filename),
|
||||
k -> readResourceBytes(context, "testdata/" + filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "real" location of the file loaded by the other commands, starting from javatests/.
|
||||
*/
|
||||
public static String filePath(Class<?> context, String filename) {
|
||||
String packagePath = context.getPackage().getName().replace('.', '/');
|
||||
return String.format("javatests/%s/testdata/%s", packagePath, filename);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue