fixed test failure because of nondeterministic output in violation report

This commit is contained in:
Lars Kühne 2007-01-27 14:07:36 +00:00
parent 7e67d70fb8
commit feec78894c
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2005 Oliver Burn
// Copyright (C) 2001-2007 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -28,6 +28,7 @@ import com.puppycrawl.tools.checkstyle.checks.CheckUtils;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
import java.util.TreeSet;
/**
* Base class for coupling calculation.
@ -202,8 +203,11 @@ public abstract class AbstractClassCouplingCheck extends Check
*/
private class Context
{
/** Set of referenced classes. */
private final Set mReferencedClassNames = new HashSet();
/**
* Set of referenced classes.
* Sorted by name for predictable error messages in unit tests.
*/
private final Set mReferencedClassNames = new TreeSet();
/** Own class name. */
private final String mClassName;
/* Location of own class. (Used to log violations) */

View File

@ -14,7 +14,7 @@ public class ClassDataAbstractionCouplingCheckTest extends BaseCheckTestCase
checkConfig.addAttribute("max", "0");
String[] expected = {
"6:1: Class Data Abstraction Coupling is 4 (max allowed is 0) classes [AnotherInnerClass, HashMap, InnerClass, HashSet].",
"6:1: Class Data Abstraction Coupling is 4 (max allowed is 0) classes [AnotherInnerClass, HashMap, HashSet, InnerClass].",
"7:5: Class Data Abstraction Coupling is 1 (max allowed is 0) classes [ArrayList].",
"27:1: Class Data Abstraction Coupling is 2 (max allowed is 0) classes [HashMap, HashSet].",
};