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 org.hamcrest.Matchers;
8   import org.junit.jupiter.api.Test;
9   
10  /**
11   * Test case for {@link PmdValidator}'s fix for #1534: the
12   * {@code UnnecessaryWarningSuppression} rule must not report
13   * {@code @SuppressWarnings("PMD.UnnecessaryWarningSuppression")}
14   * as an unused suppression of itself.
15   *
16   * @since 0.25.1
17   */
18  final class PmdUnnecessaryWarningSuppressionTest {
19  
20      @Test
21      void doesNotCatchUnnecessaryWarningSuppressionOnItself() throws Exception {
22          new PmdAssert(
23              "UnnecessaryWarningSuppressionOnItself.java",
24              Matchers.any(Boolean.class),
25              Matchers.not(
26                  Matchers.containsString("UnnecessaryWarningSuppression")
27              )
28          ).assertOk();
29      }
30  }