View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2012-2026 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.ssl.maven.plugin;
6   
7   import java.io.File;
8   import org.hamcrest.MatcherAssert;
9   import org.hamcrest.Matchers;
10  import org.junit.Rule;
11  import org.junit.Test;
12  import org.junit.rules.TemporaryFolder;
13  
14  /**
15   * Test case for {@link Keystore}.
16   *
17   * @since 0.5
18   */
19  public final class KeystoreTest {
20  
21      /**
22       * Temporary folder.
23       * @checkstyle VisibilityModifier (3 lines)
24       */
25      @Rule
26      public transient TemporaryFolder temp = new TemporaryFolder();
27  
28      /**
29       * Keystore can generate a file.
30       * @throws Exception If something is wrong
31       */
32      @Test
33      public void generatesAndActivatesKeystore() throws Exception {
34          final Keystore keystore = new Keystore("test-test");
35          keystore.activate(
36              new File(this.temp.newFolder("tmp"), "/a/b/ckeystore.jks")
37          );
38          MatcherAssert.assertThat(keystore.isActive(), Matchers.is(true));
39      }
40  
41  }