100% UTs coverage for DefaultConfiguration. #1294

This commit is contained in:
Roman Ivanov 2015-07-12 21:47:31 -07:00
parent 12a57d940d
commit 38f5fc0dc8
2 changed files with 37 additions and 2 deletions

View File

@ -1073,8 +1073,6 @@
<regex><pattern>.*.Checker</pattern><branchRate>79</branchRate><lineRate>84</lineRate></regex>
<regex><pattern>.*.ConfigurationLoader</pattern><branchRate>86</branchRate><lineRate>79</lineRate></regex>
<regex><pattern>.*.ConfigurationLoader\$.*</pattern><branchRate>65</branchRate><lineRate>84</lineRate></regex>
<regex><pattern>.*.DefaultConfiguration</pattern><branchRate>100</branchRate><lineRate>92</lineRate></regex>
<regex><pattern>.*.DefaultLogger</pattern><branchRate>75</branchRate><lineRate>76</lineRate></regex>
<regex><pattern>.*.Main</pattern><branchRate>80</branchRate><lineRate>90</lineRate></regex>
<regex><pattern>.*.PackageNamesLoader</pattern><branchRate>78</branchRate><lineRate>72</lineRate></regex>

View File

@ -0,0 +1,37 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2015 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle;
import org.junit.Assert;
import org.junit.Test;
public class DefaultConfigurationTest {
@Test
public void testRemoveChild() {
DefaultConfiguration config = new DefaultConfiguration("Myconfig");
DefaultConfiguration configChild = new DefaultConfiguration("childConfig");
Assert.assertTrue(config.getChildren().length == 0);
config.addChild(configChild);
Assert.assertTrue(config.getChildren().length == 1);
config.removeChild(configChild);
Assert.assertTrue(config.getChildren().length == 0);
}
}