From 38f5fc0dc8d44c003c6a5ff12d997289073cdfde Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Sun, 12 Jul 2015 21:47:31 -0700 Subject: [PATCH] 100% UTs coverage for DefaultConfiguration. #1294 --- pom.xml | 2 - .../checkstyle/DefaultConfigurationTest.java | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/test/java/com/puppycrawl/tools/checkstyle/DefaultConfigurationTest.java diff --git a/pom.xml b/pom.xml index cf0b241ad..98896e106 100644 --- a/pom.xml +++ b/pom.xml @@ -1073,8 +1073,6 @@ .*.Checker7984 .*.ConfigurationLoader8679 .*.ConfigurationLoader\$.*6584 - - .*.DefaultConfiguration10092 .*.DefaultLogger7576 .*.Main8090 .*.PackageNamesLoader7872 diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/DefaultConfigurationTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/DefaultConfigurationTest.java new file mode 100644 index 000000000..ab6fbdab3 --- /dev/null +++ b/src/test/java/com/puppycrawl/tools/checkstyle/DefaultConfigurationTest.java @@ -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); + } +}