package org.kohsuke.github;

import org.junit.Assert;
import org.junit.Before;
import org.kohsuke.randname.RandomNameGenerator;

import java.io.File;

/**
 * @author Kohsuke Kawaguchi
 */
public abstract class AbstractGitHubApiTestBase extends Assert {

    protected GitHub gitHub;

    @Before
    public void setUp() throws Exception {
        File f = new File(System.getProperty("user.home"), ".github.kohsuke2");
        if (f.exists()) {
            // use the non-standard credential preferentially, so that developers of this library do not have
            // to clutter their event stream.
            gitHub = GitHubBuilder.fromPropertyFile(f.getPath()).build();
        } else {
            gitHub = GitHub.connect();
        }
    }

    protected static final RandomNameGenerator rnd = new RandomNameGenerator();
}

@@ -659,16 +659,60 @@
 Path()).
+withRateLimitHandler(RateLimitHandler.FAIL).
 build();
@@ -760,16 +760,83 @@
 tHub
-.connect
+Builder.fromCredentials().withRateLimitHandler(RateLimitHandler.FAIL).build
 ();%0A

Use FAIL rate-limit handler for tests