use of com.jcabi.github.mock.MkGithub in project jcabi-github by jcabi.
the class RtPullRefTest method fetchesRepo.
/**
* RtPullRef can fetch its repo.
* @throws IOException If there is an I/O problem.
*/
@Test
public void fetchesRepo() throws IOException {
final Repo repo = new MkGithub().randomRepo();
MatcherAssert.assertThat(RtPullRefTest.pullRef(repo).repo().coordinates(), Matchers.equalTo(repo.coordinates()));
}
use of com.jcabi.github.mock.MkGithub in project jcabi-github by jcabi.
the class RtReferencesTest method iteratesReferences.
/**
* RtReferences should be able to iterate over References.
* @throws Exception - If something goes wrong.
*/
@Test
public void iteratesReferences() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"ref\":\"refs/heads/feature-a\"}")).start();
final References refs = new RtReferences(new ApacheRequest(container.home()), new MkGithub().randomRepo());
try {
MatcherAssert.assertThat(refs.iterate(), Matchers.notNullValue());
} finally {
container.stop();
}
}
use of com.jcabi.github.mock.MkGithub in project jcabi-github by jcabi.
the class RtOrganizationTest method canFetchIssueAsJson.
/**
* RtOrganization should be able to describe itself in JSON format.
*
* @throws Exception if a problem occurs.
*/
@Test
public void canFetchIssueAsJson() throws Exception {
final RtOrganization org = new RtOrganization(new MkGithub(), new FakeRequest().withBody("{\"organization\":\"json\"}"), "testJson");
MatcherAssert.assertThat(org.json().getString("organization"), Matchers.equalTo("json"));
}
use of com.jcabi.github.mock.MkGithub in project jcabi-github by jcabi.
the class RtOrganizationTest method canRepresentAsString.
/**
* RtOrganization can return a String representation correctly reflecting
* its URI.
*
* @throws Exception if something goes wrong.
*/
@Test
public void canRepresentAsString() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "blah")).start();
final RtOrganization org = new RtOrganization(new MkGithub(), new ApacheRequest(container.home()), "testToString");
try {
MatcherAssert.assertThat(org.toString(), Matchers.endsWith("/orgs/testToString"));
} finally {
container.stop();
}
}
use of com.jcabi.github.mock.MkGithub in project jcabi-github by jcabi.
the class RtReferenceTest method returnsRef.
/**
* RtReference should be able to return its ref.
* @throws Exception - If something goes wrong.
*/
@Test
public void returnsRef() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"ref\":\"refs/heads/featureC\"}")).start();
final Reference reference = new RtReference(new ApacheRequest(container.home()), new MkGithub().randomRepo(), "refs/heads/featureC");
try {
MatcherAssert.assertThat(reference.ref(), Matchers.is("refs/heads/featureC"));
} finally {
container.stop();
}
}
Aggregations