View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2013-2025 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.github;
6   
7   import com.jcabi.http.request.FakeRequest;
8   import org.hamcrest.MatcherAssert;
9   import org.hamcrest.Matchers;
10  import org.junit.jupiter.api.Test;
11  import org.mockito.Mockito;
12  
13  /**
14   * Test case for {@link RtGit}.
15   * @since 0.8
16   */
17  final class RtGitTest {
18  
19      @Test
20      void canFetchOwnRepo() {
21          final Repo repo = RtGitTest.repo();
22          MatcherAssert.assertThat(
23              "Values are not equal",
24              new RtGit(new FakeRequest(), repo).repo(),
25              Matchers.is(repo)
26          );
27      }
28  
29      /**
30       * Create and return repo for testing.
31       * @return Repo
32       */
33      private static Repo repo() {
34          final Repo repo = Mockito.mock(Repo.class);
35          Mockito.doReturn(new Coordinates.Simple("test", "git"))
36              .when(repo).coordinates();
37          return repo;
38      }
39  
40  }