package com.natpryce.worktorule.issues.github;

import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class GitHubPublicIssuesTest {
    GitHubIssues issues = new GitHubIssues("npryce", "worktorule-testing");

    @Test
    public void openIssue() throws IOException {
        assertTrue(issues.isOpen("1"));
    }

    @Test
    public void closedIssue() throws IOException {
        assertFalse(issues.isOpen("2"));
    }
}

@@ -41,16 +41,187 @@
 ithub;%0A%0A
+import com.fasterxml.jackson.databind.JsonNode;%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport org.junit.AssumptionViolatedException;%0Aimport org.junit.Before;%0A
 import o
@@ -235,16 +235,16 @@
 t.Test;%0A
-
 %0Aimport 
@@ -263,16 +263,37 @@
 ception;
+%0Aimport java.net.URL;
 %0A%0Aimport
@@ -412,16 +412,16 @@
 sTest %7B%0A
-
     GitH
@@ -489,16 +489,443 @@
 ing%22);%0A%0A
+    @Before%0A    public void checkRateLimit() throws IOException %7B%0A        JsonNode rateLimitNode = new ObjectMapper().readTree(new URL(%22https://api.github.com/rate_limit%22));%0A        int requestsRemaining = rateLimitNode.findPath(%22resources%22).findPath(%22core%22).findPath(%22remaining%22).intValue();%0A%0A        if (requestsRemaining %3C= 0) %7B%0A            throw new AssumptionViolatedException(%22API rate limit exceeded%22);%0A        %7D%0A    %7D%0A%0A
     @Tes

Check GitHub API rate limits before test and skip test if rate limit exceeded