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   *
16   * @since 0.25.1
17   */
18  final class PmdTransientFieldsTest {
19  
20      @Test
21      void allowsNonTransientFields() throws Exception {
22          new PmdAssert(
23              "AllowNonTransientFields.java",
24              Matchers.is(true),
25              Matchers.not(
26                  Matchers.containsString(
27                      "Found non-transient, non-static member."
28                  )
29              )
30          ).assertOk();
31      }
32  }