Add test coverage to toString in JavadocNodeImpl. #1308

This commit is contained in:
Michal Kordas 2015-07-08 00:11:14 +02:00 committed by Roman Ivanov
parent f217ae7873
commit e0471bb7f2
2 changed files with 40 additions and 1 deletions

View File

@ -834,7 +834,6 @@
<regex><pattern>.*.checks.javadoc.AtclauseOrderCheck</pattern><branchRate>88</branchRate><lineRate>88</lineRate></regex>
<regex><pattern>.*.checks.javadoc.HtmlTag</pattern><branchRate>75</branchRate><lineRate>90</lineRate></regex>
<regex><pattern>.*.checks.javadoc.JavadocMethodCheck</pattern><branchRate>90</branchRate><lineRate>96</lineRate></regex>
<regex><pattern>.*.checks.javadoc.JavadocNodeImpl</pattern><branchRate>50</branchRate><lineRate>84</lineRate></regex>
<regex><pattern>.*.checks.javadoc.JavadocPackageCheck</pattern><branchRate>80</branchRate><lineRate>95</lineRate></regex>
<regex><pattern>.*.checks.javadoc.JavadocParagraphCheck</pattern><branchRate>92</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.javadoc.JavadocStyleCheck</pattern><branchRate>89</branchRate><lineRate>97</lineRate></regex>

View File

@ -0,0 +1,40 @@
////////////////////////////////////////////////////////////////////////////////
// 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.checks.javadoc;
import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class JavadocNodeImplTest {
@Test
public void testToString() {
JavadocNodeImpl javadocNode = new JavadocNodeImpl();
javadocNode.setType(JavadocTokenTypes.CODE_LITERAL);
javadocNode.setLineNumber(1);
javadocNode.setColumnNumber(2);
String result = javadocNode.toString();
assertEquals("CODE_LITERAL[1x2]", result);
}
}