Fix typo and reword some explanations

This commit is contained in:
XiangRongLin 2021-02-26 17:47:22 +01:00
parent adf9d7d10f
commit e13e237392
2 changed files with 13 additions and 12 deletions

View File

@ -9,7 +9,7 @@ import java.lang.annotation.Target;
import javax.annotation.Nonnull;
/**
* Marker annotation to skip test if it not run with mocks.
* Marker annotation to skip test in certain cases.
*
* {@link MockOnlyRule}
*/
@ -19,7 +19,7 @@ import javax.annotation.Nonnull;
public @interface MockOnly {
/**
* Explanation why this test shold only be run with mocks and not against real websites
* Explanation why this test should be skipped
*/
@Nonnull String reason();
}

View File

@ -9,19 +9,21 @@ import org.schabi.newpipe.downloader.DownloaderType;
import javax.annotation.Nonnull;
/**
* <p>
* Checks if the system variable "downloader" is set to "REAL" and skips the tests if it is.
* Otherwise execute the test.
* </p>
*
* <p>
* Use it by creating a public variable of this inside the test class and annotate it with
* {@link org.junit.Rule}. Then annotate the tests to be skipped with {@link MockOnly}
* </p>
*
* <p>
* Allows skipping unreliable or time sensitive tests in CI pipeline.
* </p>
*
* <p>
* Use it by creating a public variable of this inside the test class and annotate it with
* {@link org.junit.Rule}. Then annotate the specific tests to be skipped with {@link MockOnly}
* </p>
*
* <p>
* It works by checking if the system variable "downloader" is set to "REAL" and skips the tests if it is.
* Otherwise it executes the test.
* </p>
*/
public class MockOnlyRule implements TestRule {
@ -42,7 +44,6 @@ public class MockOnlyRule implements TestRule {
+ annotation.reason(), isMockDownloader);
}
base.evaluate();
}
};