Commit 113c4188 by ibaker Committed by Oliver Woodman

Explain how to overwrite golden data in extractor test failure message

This info is already in the javadoc of FakeExtractorOutput#assertOutput
but it's not super discoverable if you just see the test failure. I was
manually copying the dump results around before realising there was
a mechanism to auto-update.

PiperOrigin-RevId: 296204463
parent 7a10f2bf
...@@ -129,7 +129,14 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab ...@@ -129,7 +129,14 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
if (DUMP_FILE_ACTION == COMPARE_WITH_EXISTING) { if (DUMP_FILE_ACTION == COMPARE_WITH_EXISTING) {
String expected = TestUtil.getString(context, dumpFile); String expected = TestUtil.getString(context, dumpFile);
assertWithMessage(dumpFile).that(actual).isEqualTo(expected); assertWithMessage(
"Extractor output doesn't match golden file: %s\n"
+ "To update the golden, change FakeExtractorOutput#DUMP_FILE_ACTION to"
+ " WRITE_TO_LOCAL (for Robolectric tests) or WRITE_TO_DEVICE (for"
+ " instrumentation tests) and re-run the test.",
dumpFile)
.that(actual)
.isEqualTo(expected);
} else { } else {
File file = File file =
DUMP_FILE_ACTION == WRITE_TO_LOCAL DUMP_FILE_ACTION == WRITE_TO_LOCAL
......
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