Issue #1289: 'EmptyForIteratorPadCheck' UT coverage improved

This commit is contained in:
Ruslan Diachenko 2015-07-15 01:03:29 +01:00 committed by Roman Ivanov
parent d815ca6429
commit c09a1ecf33
2 changed files with 18 additions and 7 deletions

View File

@ -1203,7 +1203,6 @@
<regex><pattern>.*.checks.whitespace.AbstractParenPadCheck</pattern><branchRate>88</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.whitespace.EmptyForInitializerPadCheck</pattern><branchRate>91</branchRate><lineRate>93</lineRate></regex>
<regex><pattern>.*.checks.whitespace.EmptyForIteratorPadCheck</pattern><branchRate>100</branchRate><lineRate>92</lineRate></regex>
<regex><pattern>.*.checks.whitespace.EmptyLineSeparatorCheck</pattern><branchRate>95</branchRate><lineRate>98</lineRate></regex>
<regex><pattern>.*.checks.whitespace.GenericWhitespaceCheck</pattern><branchRate>86</branchRate><lineRate>96</lineRate></regex>
<regex><pattern>.*.checks.whitespace.NoWhitespaceAfterCheck</pattern><branchRate>94</branchRate><lineRate>98</lineRate></regex>

View File

@ -19,15 +19,16 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck.WS_FOLLOWED;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck.WS_NOT_FOLLOWED;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck
.WS_FOLLOWED;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck
.WS_NOT_FOLLOWED;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class EmptyForIteratorPadCheckTest
extends BaseCheckTestSupport {
@ -55,4 +56,15 @@ public class EmptyForIteratorPadCheckTest
};
verify(checkConfig, getPath("InputForWhitespace.java"), expected);
}
@Test
public void testGetAcceptableTokens() {
EmptyForIteratorPadCheck emptyForIteratorPadCheckObj = new EmptyForIteratorPadCheck();
int[] actual = emptyForIteratorPadCheckObj.getAcceptableTokens();
int[] expected = new int[] {
TokenTypes.FOR_ITERATOR,
};
Assert.assertNotNull(actual);
Assert.assertArrayEquals(expected, actual);
}
}