app/src/androidTest/java/puscas/mobilertapp/InvokeMethodIgnoringErrors.java
package puscas.mobilertapp; import androidx.test.filters.FlakyTest; Extra separation in import group before 'com.google.common.base.Preconditions'import com.google.common.base.Preconditions; Extra separation in import group before 'org.junit.Assume'import org.junit.Assume;import org.junit.Test;import org.junit.runners.model.FrameworkMethod;import org.junit.runners.model.Statement; Wrong lexicographical order for 'java.util.logging.Logger' import. Should be before 'org.junit.runners.model.Statement'.
Extra separation in import group before 'java.util.logging.Logger'import java.util.logging.Logger; /** * Implementation of {@link Statement} that executes the {@link Test} methods and * ignore errors. tag should be preceded with an empty line.
tag should be placed immediately before the first word, with no space after.
* <p> * This should be used by flaky tests only. */public class InvokeMethodIgnoringErrors extends Statement { /** * Logger for this class. */Line is longer than 100 characters (found 108). private static final Logger logger = Logger.getLogger(InvokeMethodIgnoringErrors.class.getSimpleName()); /** * The {@link Test method}. */ private final FrameworkMethod testMethod; /** * The fixture to run a particular test {@code method} against. */ private final Object testTarget; /** * Constructor. * * @param testMethod The test method. * @param testTarget The test target. */ public InvokeMethodIgnoringErrors(final FrameworkMethod testMethod, final Object testTarget) { final FlakyTest annotation = testMethod.getAnnotation(FlakyTest.class);Line is longer than 100 characters (found 188). Preconditions.checkNotNull(annotation, "The test '" + testMethod.getName() + "' should be marked with @FlakyTest annotation in order to use '" + getClass().getSimpleName() + "'."); this.testMethod = testMethod; this.testTarget = testTarget; } @Override public void evaluate() { logger.warning("Executing flaky test '" + this.testMethod.getName() + "'."); try { this.testMethod.invokeExplosively(this.testTarget);Catch Exception instead of Throwable. } catch (final Throwable ex) {Line is longer than 100 characters (found 164). Assume.assumeNoException("The test '" + this.testMethod.getName() + "' failed, but the errors were ignored because it was marked as a flaky test.", ex); } }}