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   import org.junit.jupiter.api.condition.EnabledForJreRange;
10  import org.junit.jupiter.api.condition.JRE;
11  
12  /**
13   * Test case for {@link PmdValidator}'s support for Java record
14   * classes (parsed cleanly and not flagged as public-static-method
15   * violations).
16   *
17   * @since 0.25.1
18   */
19  final class PmdRecordClassesTest {
20  
21      @Test
22      @EnabledForJreRange(min = JRE.JAVA_21, max = JRE.JAVA_25)
23      void allowsRecordClasses() throws Exception {
24          new PmdAssert(
25              "RecordParsed.java",
26              Matchers.is(true),
27              Matchers.not(
28                  Matchers.containsString("Public static methods are prohibited")
29              )
30          ).assertOk();
31      }
32  }