From 113c4188849adcdc9896bbd23ef028f37b952101 Mon Sep 17 00:00:00 2001 From: ibaker Date: Thu, 20 Feb 2020 15:34:27 +0000 Subject: [PATCH] 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 --- .../android/exoplayer2/testutil/FakeExtractorOutput.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java index ad9d8dcdd2..5cefbff1e8 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java @@ -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