Search in sources :

Example 6 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkRepoCommitTest method compareDifferent.

/**
 * MkRepoCommit can compare different commits.
 * @throws Exception If some problem inside
 */
@Test
public void compareDifferent() throws Exception {
    final MkStorage storage = new MkStorage.InFile();
    final Repo repo = this.repo(storage);
    final MkRepoCommit commit = new MkRepoCommit(storage, repo, "6dcd4ce23d88e2ee9568ba546c007c63d9131c1b");
    final MkRepoCommit other = new MkRepoCommit(storage, repo, "e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98");
    MatcherAssert.assertThat(commit.compareTo(other), Matchers.not(0));
    MatcherAssert.assertThat(other.compareTo(commit), Matchers.not(0));
}
Also used : Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 7 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkRepoCommitTest method canCompareInstances.

/**
 * MkRepoCommit should be able to compare different instances.
 *
 * @throws Exception when a problem occurs.
 */
@Test
public void canCompareInstances() throws Exception {
    final MkStorage storage = new MkStorage.InFile();
    final Repo repoa = new MkRepo(storage, "login1", new Coordinates.Simple("test_login1", "test_repo1"));
    final Repo repob = new MkRepo(storage, "login2", new Coordinates.Simple("test_login2", "test_repo2"));
    final MkRepoCommit less = new MkRepoCommit(storage, repoa, SHA1);
    final MkRepoCommit greater = new MkRepoCommit(storage, repob, SHA2);
    MatcherAssert.assertThat(less.compareTo(greater), Matchers.lessThan(0));
    MatcherAssert.assertThat(greater.compareTo(less), Matchers.greaterThan(0));
}
Also used : Repo(com.jcabi.github.Repo) Coordinates(com.jcabi.github.Coordinates) Test(org.junit.Test)

Example 8 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkRepoCommitTest method compareEqual.

/**
 * MkRepoCommit can compare equal commits.
 * @throws Exception If some problem inside
 */
@Test
public void compareEqual() throws Exception {
    final String sha = "c2c53d66948214258a26ca9ca845d7ac0c17f8e7";
    final MkStorage storage = new MkStorage.InFile();
    final Repo repo = this.repo(storage);
    final MkRepoCommit commit = new MkRepoCommit(storage, repo, sha);
    final MkRepoCommit other = new MkRepoCommit(storage, repo, sha);
    MatcherAssert.assertThat(commit.compareTo(other), Matchers.equalTo(0));
    MatcherAssert.assertThat(other.compareTo(commit), Matchers.equalTo(0));
}
Also used : Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 9 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkRepoCommitTest method getRepo.

/**
 * MkRepoCommit can return repository.
 * @throws IOException If some problem inside
 */
@Test
public void getRepo() throws IOException {
    final MkStorage storage = new MkStorage.InFile();
    final Repo repo = this.repo(storage);
    MatcherAssert.assertThat(new MkRepoCommit(storage, repo, SHA1).repo(), Matchers.equalTo(repo));
}
Also used : Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 10 with Repo

use of com.jcabi.github.Repo in project jcabi-github by jcabi.

the class MkRepoTest method fetchBranches.

/**
 * Repo can fetch its branches.
 *
 * @throws IOException if some problem inside
 */
@Test
public void fetchBranches() throws IOException {
    final String user = "testuser";
    final Repo repo = new MkRepo(new MkStorage.InFile(), user, new Coordinates.Simple(user, "testrepo"));
    MatcherAssert.assertThat(repo.branches(), Matchers.notNullValue());
}
Also used : Repo(com.jcabi.github.Repo) Coordinates(com.jcabi.github.Coordinates) Test(org.junit.Test)

Aggregations

Repo (com.jcabi.github.Repo)57 Test (org.junit.Test)55 Coordinates (com.jcabi.github.Coordinates)11 Issue (com.jcabi.github.Issue)10 Repos (com.jcabi.github.Repos)10 References (com.jcabi.github.References)5 Github (com.jcabi.github.Github)3 JsonObject (javax.json.JsonObject)3 Comment (com.jcabi.github.Comment)2 Content (com.jcabi.github.Content)2 Event (com.jcabi.github.Event)2 RepoCommit (com.jcabi.github.RepoCommit)2 ArrayMap (com.jcabi.immutable.ArrayMap)2 Branch (com.jcabi.github.Branch)1 Contents (com.jcabi.github.Contents)1 Fork (com.jcabi.github.Fork)1 IssueLabels (com.jcabi.github.IssueLabels)1 Label (com.jcabi.github.Label)1 Labels (com.jcabi.github.Labels)1 Language (com.jcabi.github.Language)1