View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2013-2025 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.github.mock;
6   
7   import com.jcabi.github.Gitignores;
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   * Test case for {@link MkGitignores}.
15   * @since 0.8
16   */
17  final class MkGitignoresTest {
18      @Test
19      void canFetchSingleRawTemplate() throws IOException {
20          final Gitignores gitignores = new MkGitHub().gitignores();
21          MatcherAssert.assertThat(
22              "String does not start with expected value",
23              gitignores.template("Java"),
24              Matchers.startsWith("*.class")
25          );
26      }
27  
28      @Test
29      void canIterateOverTemplates() throws IOException {
30          final Gitignores gitignores = new MkGitHub().gitignores();
31          MatcherAssert.assertThat(
32              "Collection is not empty",
33              gitignores.iterate(),
34              Matchers.not(Matchers.emptyIterable())
35          );
36      }
37  }