Add test coverage for LineSet and improve its toString method. #1270
This commit is contained in:
parent
af92d5ac9b
commit
7853d28eea
2
pom.xml
2
pom.xml
|
|
@ -830,7 +830,6 @@
|
|||
<regex><pattern>.*.checks.indentation.ImportHandler</pattern><branchRate>50</branchRate><lineRate>87</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.IndentationCheck</pattern><branchRate>100</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.IndexHandler</pattern><branchRate>100</branchRate><lineRate>75</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.LineSet</pattern><branchRate>100</branchRate><lineRate>90</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.LineWrappingHandler</pattern><branchRate>87</branchRate><lineRate>91</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.MethodCallHandler</pattern><branchRate>63</branchRate><lineRate>87</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.MethodCallLineWrapHandler</pattern><branchRate>0</branchRate><lineRate>0</lineRate></regex>
|
||||
|
|
@ -840,7 +839,6 @@
|
|||
<regex><pattern>.*.checks.indentation.PackageDefHandler</pattern><branchRate>50</branchRate><lineRate>85</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.PrimordialHandler</pattern><branchRate>100</branchRate><lineRate>60</lineRate></regex>
|
||||
<regex><pattern>.*.checks.indentation.SlistHandler</pattern><branchRate>100</branchRate><lineRate>94</lineRate></regex>
|
||||
|
||||
<regex><pattern>.*.checks.indentation.SynchronizedHandler</pattern><branchRate>100</branchRate><lineRate>100</lineRate></regex>
|
||||
|
||||
<regex><pattern>.*.checks.javadoc.AbstractJavadocCheck</pattern><branchRate>90</branchRate><lineRate>93</lineRate></regex>
|
||||
|
|
|
|||
|
|
@ -93,6 +93,6 @@ public class LineSet {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LineSet[ start=" + firstLine() + ", last=" + lastLine() + "]";
|
||||
return "LineSet[firstLine=" + firstLine() + ", lastLine=" + lastLine() + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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.indentation;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class LineSetTest {
|
||||
|
||||
@Test
|
||||
public void testToStringShowingFirstAndLastLine() {
|
||||
LineSet lineSet = new LineSet();
|
||||
lineSet.addLineAndCol(0, 1);
|
||||
lineSet.addLineAndCol(2, 3);
|
||||
|
||||
String result = lineSet.toString();
|
||||
|
||||
assertEquals("LineSet[firstLine=0, lastLine=2]", result);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue