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   * @since 0.25.1
17   */
18  final class PmdRecordClassesTest {
19  
20      @Test
21      @EnabledForJreRange(min = JRE.JAVA_21, max = JRE.JAVA_25)
22      void allowsRecordClasses() throws Exception {
23          new PmdAssert(
24              "RecordParsed.java",
25              Matchers.is(true),
26              Matchers.not(
27                  Matchers.containsString("Public static methods are prohibited")
28              )
29          ).assertOk();
30      }
31  }