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   * @since 0.25.1
16   */
17  final class PmdUnnecessaryWarningSuppressionTest {
18  
19      @Test
20      void doesNotCatchUnnecessaryWarningSuppressionOnItself() throws Exception {
21          new PmdAssert(
22              "UnnecessaryWarningSuppressionOnItself.java",
23              Matchers.any(Boolean.class),
24              Matchers.not(
25                  Matchers.containsString("UnnecessaryWarningSuppression")
26              )
27          ).assertOk();
28      }
29  }