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 tolerance of non-static,
12   * non-transient fields (the {@code BeanMembersShouldSerialize} /
13   * {@code NonTransientFieldInSerializableClass} rule is disabled
14   * for qulice-style code).
15   * @since 0.25.1
16   */
17  final class PmdTransientFieldsTest {
18  
19      @Test
20      void allowsNonTransientFields() throws Exception {
21          new PmdAssert(
22              "AllowNonTransientFields.java",
23              Matchers.is(true),
24              Matchers.not(
25                  Matchers.containsString(
26                      "Found non-transient, non-static member."
27                  )
28              )
29          ).assertOk();
30      }
31  }