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 handling of the
12 * {@code LooseCoupling} rule: fields, parameters and return
13 * types declared with concrete collection implementations
14 * such as {@code ConcurrentHashMap} or {@code HashMap} must
15 * be reported (issue #734).
16 *
17 * @since 0.25.1
18 */
19 final class PmdLooseCouplingTest {
20
21 @Test
22 void reportsConcreteCollectionTypes() throws Exception {
23 new PmdAssert(
24 "ConcreteCollectionTypes.java",
25 Matchers.is(false),
26 Matchers.allOf(
27 Matchers.containsString("(LooseCoupling)"),
28 Matchers.containsString("ConcurrentHashMap"),
29 Matchers.containsString("HashMap")
30 )
31 ).assertOk();
32 }
33 }