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.aspects.Immutable;
8   import java.io.IOException;
9   import org.hamcrest.MatcherAssert;
10  import org.hamcrest.Matchers;
11  import org.junit.jupiter.api.Test;
12  
13  /**
14   * Integration case for {@link RtGitignores}.
15   * @see <a href="https://developer.github.com/v3/gitignore/">Gitignore API</a>
16   * @since 0.8
17   */
18  @Immutable
19  @OAuthScope(OAuthScope.Scope.REPO)
20  final class RtGitignoresITCase {
21  
22      @Test
23      void iterateTemplateNames() throws IOException {
24          final Gitignores gitignores = RtGitignoresITCase.gitignores();
25          MatcherAssert.assertThat(
26              "Collection does not contain expected item",
27              gitignores.iterate(),
28              Matchers.hasItem("C++")
29          );
30      }
31  
32      @Test
33      void getRawTemplateByName() throws IOException {
34          final Gitignores gitignores = RtGitignoresITCase.gitignores();
35          MatcherAssert.assertThat(
36              "String does not contain expected value",
37              gitignores.template("C"),
38              Matchers.containsString("#")
39          );
40      }
41  
42      /**
43       * Create and return gitignores object to test.
44       * @return Gitignores
45       */
46      private static Gitignores gitignores() {
47          return new RtGitignores(GitHubIT.connect());
48      }
49  }