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
This commit is contained in:
ibaker 2020-02-20 15:34:27 +00:00 committed by Oliver Woodman
parent 7a10f2bff3
commit 113c418884

View file

@ -129,7 +129,14 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab
if (DUMP_FILE_ACTION == COMPARE_WITH_EXISTING) {
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 {
File file =
DUMP_FILE_ACTION == WRITE_TO_LOCAL