Commit 80e3152e by olly Committed by Oliver Woodman

Make it easier to update extractor test dump files

PiperOrigin-RevId: 285407744
parent 052550e9
......@@ -33,9 +33,11 @@ import java.io.PrintWriter;
public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpable {
/**
* If true, makes {@link #assertOutput(Context, String)} method write dump result to {@code
* /sdcard/Android/data/apk_package/ + dumpfile} file instead of comparing it with an existing
* file.
* If true, makes {@link #assertOutput(Context, String)} method write the output to the dump file,
* rather than validating that the output matches what the dump file already contains.
*
* <p>Enabling this option works when tests are run in Android Studio. It may not work when the
* tests are run in another environment.
*/
private static final boolean WRITE_DUMP = false;
......@@ -121,8 +123,8 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
String actual = new Dumper().add(this).toString();
if (WRITE_DUMP) {
File directory = context.getExternalFilesDir(null);
File file = new File(directory, dumpFile);
File file = new File(System.getProperty("user.dir"), "src/test/assets");
file = new File(file, dumpFile);
file.getParentFile().mkdirs();
PrintWriter out = new PrintWriter(file);
out.print(actual);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment