ClassDataAbstractionCouplingCheck.java

1
////////////////////////////////////////////////////////////////////////////////
2
// checkstyle: Checks Java source code for adherence to a set of rules.
3
// Copyright (C) 2001-2017 the original author or authors.
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
////////////////////////////////////////////////////////////////////////////////
19
20
package com.puppycrawl.tools.checkstyle.checks.metrics;
21
22
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
23
24
/**
25
 * This metric measures the number of instantiations of other classes
26
 * within the given class.
27
 *
28
 * @author <a href="mailto:simon@redhillconsulting.com.au">Simon Harris</a>
29
 * @author o_sukhodolsky
30
 */
31
public final class ClassDataAbstractionCouplingCheck
32
    extends AbstractClassCouplingCheck {
33
34
    /**
35
     * A key is pointing to the warning message text in "messages.properties"
36
     * file.
37
     */
38
    public static final String MSG_KEY = "classDataAbstractionCoupling";
39
40
    /** Default allowed complexity. */
41
    private static final int DEFAULT_MAX = 7;
42
43
    /** Creates bew instance of the check. */
44
    public ClassDataAbstractionCouplingCheck() {
45
        super(DEFAULT_MAX);
46
    }
47
48
    @Override
49
    public int[] getRequiredTokens() {
50 1 1. getRequiredTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck::getRequiredTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return new int[] {
51
            TokenTypes.PACKAGE_DEF,
52
            TokenTypes.IMPORT,
53
            TokenTypes.CLASS_DEF,
54
            TokenTypes.INTERFACE_DEF,
55
            TokenTypes.ENUM_DEF,
56
            TokenTypes.LITERAL_NEW,
57
        };
58
    }
59
60
    @Override
61
    public int[] getAcceptableTokens() {
62 1 1. getAcceptableTokens : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck::getAcceptableTokens to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return new int[] {
63
            TokenTypes.PACKAGE_DEF,
64
            TokenTypes.IMPORT,
65
            TokenTypes.CLASS_DEF,
66
            TokenTypes.INTERFACE_DEF,
67
            TokenTypes.ENUM_DEF,
68
            TokenTypes.LITERAL_NEW,
69
        };
70
    }
71
72
    // -@cs[SimpleAccessorNameNotation] Overrides method from the base class.
73
    // Issue: https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/166
74
    @Override
75
    protected String getLogMessageId() {
76 1 1. getLogMessageId : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck::getLogMessageId to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return MSG_KEY;
77
    }
78
}

Mutations

50

1.1
Location : getRequiredTokens
Killed by : com.puppycrawl.tools.checkstyle.checks.metrics.ClassDataAbstractionCouplingCheckTest.testExludedPackageCommonPackagesAllIgnored(com.puppycrawl.tools.checkstyle.checks.metrics.ClassDataAbstractionCouplingCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck::getRequiredTokens to ( if (x != null) null else throw new RuntimeException ) → KILLED

62

1.1
Location : getAcceptableTokens
Killed by : none
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck::getAcceptableTokens to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

76

1.1
Location : getLogMessageId
Killed by : com.puppycrawl.tools.checkstyle.checks.metrics.ClassDataAbstractionCouplingCheckTest.testRegularExpression(com.puppycrawl.tools.checkstyle.checks.metrics.ClassDataAbstractionCouplingCheckTest)
mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck::getLogMessageId to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.2.4