From 26d50aca05c0135ed505a226f2760c78d386050b Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Wed, 17 Feb 2021 19:21:39 +0100 Subject: [PATCH] Add comment explaining YoutubeParsingHelper.resetClientVersionAndKey --- .../services/youtube/YoutubeParsingHelper.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java index b3fc3b93..dd636833 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java @@ -358,9 +358,19 @@ public class YoutubeParsingHelper { } /** - * Only use in tests. + *

+ * Only use in tests. + *

* + *

* Quick-and-dirty solution to reset global state in between test classes. + *

+ *

+ * This is needed for the mocks because in order to reach that state a network request has to + * be made. If the global state is not reset and the RecordingDownloader is used, + * then only the first test class has that request recorded. Meaning running the other + * tests with mocks will fail, because the mock is missing. + *

*/ public static void resetClientVersionAndKey() { clientVersion = null;