100% UTs coverage for PropertiesExpander ans PackageObjectFactory. #1294

This commit is contained in:
Roman Ivanov 2015-07-12 21:59:42 -07:00
parent 38f5fc0dc8
commit cb4bd82807
3 changed files with 38 additions and 2 deletions

View File

@ -1076,8 +1076,6 @@
<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>
<regex><pattern>.*.PackageObjectFactory</pattern><branchRate>75</branchRate><lineRate>75</lineRate></regex>
<regex><pattern>.*.PropertiesExpander</pattern><branchRate>50</branchRate><lineRate>83</lineRate></regex>
<regex><pattern>.*.PropertyCacheFile</pattern><branchRate>22</branchRate><lineRate>19</lineRate></regex>
<regex><pattern>.*.TreeWalker</pattern><branchRate>94</branchRate><lineRate>92</lineRate></regex>

View File

@ -37,6 +37,12 @@ public class PackageObjectFactoryTest {
private final PackageObjectFactory factory = new PackageObjectFactory(
new HashSet<String>(), Thread.currentThread().getContextClassLoader());
@Test(expected = IllegalArgumentException.class)
public void testCtorException() throws CheckstyleException {
PackageObjectFactory factory = new PackageObjectFactory(
new HashSet<String>(), null);
}
@Test
public void testMakeObjectFromName()
throws CheckstyleException {

View File

@ -0,0 +1,32 @@
////////////////////////////////////////////////////////////////////////////////
// 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 com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import org.junit.Test;
public class PropertiesExpanderTest {
@Test(expected = IllegalArgumentException.class)
public void testCtorException() throws CheckstyleException {
PropertiesExpander object = new PropertiesExpander(null);
}
}