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 * @since 0.25.1
17 */
18 final class PmdLooseCouplingTest {
19
20 @Test
21 void reportsConcreteCollectionTypes() throws Exception {
22 new PmdAssert(
23 "ConcreteCollectionTypes.java",
24 Matchers.is(false),
25 Matchers.allOf(
26 Matchers.containsString("(LooseCoupling)"),
27 Matchers.containsString("ConcurrentHashMap"),
28 Matchers.containsString("HashMap")
29 )
30 ).assertOk();
31 }
32 }