mirror of
https://github.com/google/nomulus
synced 2026-09-05 07:37:09 +00: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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user