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 org.hamcrest.MatcherAssert;
8   import org.hamcrest.Matchers;
9   import org.junit.jupiter.api.Assertions;
10  import org.junit.jupiter.api.Test;
11  
12  /**
13   * Unit tests for {@link FromProperties}.
14   * @since 0.37
15   */
16  final class FromPropertiesTest {
17  
18      @Test
19      void formatsUserAgent() {
20          MatcherAssert.assertThat(
21              "String does not start with expected value",
22              new FromProperties("jcabigithub.properties").format(),
23              Matchers.startsWith("jcabi-github ")
24          );
25      }
26  
27      @Test
28      void throwsExceptionOnMissingFile() {
29          Assertions.assertThrows(
30              NullPointerException.class,
31              () -> new FromProperties("missing.properties").format(),
32              "Should throw when properties file is missing"
33          );
34      }
35  
36  }