View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2011-2026 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.qulice.pmd;
6   
7   import java.util.Arrays;
8   import java.util.Collection;
9   import org.hamcrest.Matchers;
10  import org.junit.jupiter.params.ParameterizedTest;
11  import org.junit.jupiter.params.provider.MethodSource;
12  
13  /**
14   * Tests for rules that PMD ships and Qulice enables.
15   *
16   * @since 0.25.1
17   */
18  final class PmdEnabledRulesTest {
19  
20      @ParameterizedTest
21      @MethodSource("parameters")
22      void enablesRules(final String rule) throws Exception {
23          new PmdAssert(
24              String.format("%s.java", rule),
25              Matchers.is(false),
26              Matchers.containsString(String.format("(%s)", rule))
27          ).assertOk();
28      }
29  
30      static Collection<String[]> parameters() {
31          return Arrays.asList(
32              new String[][] {
33                  {"HardCodedCryptoKey"},
34                  {"InsecureCryptoIv"},
35                  {"LiteralsFirstInComparisons"},
36                  {"UseDiamondOperator"},
37                  {"LinguisticNaming"},
38                  {"NonSerializableClass"},
39              }
40          );
41      }
42  }