Skip to content

Commit

Permalink
Issue #2161: unify test input locations
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach authored and romani committed Oct 12, 2015
1 parent e23953e commit 11dc88a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

import static com.puppycrawl.tools.checkstyle.checks.coding.ModifiedControlVariableCheck.MSG_KEY;

import java.io.File;
import java.io.IOException;

import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
Expand All @@ -32,6 +35,12 @@

public class ModifiedControlVariableCheckTest
extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "coding" + File.separator + filename);
}

@Test
public void testModifiedControlVariable() throws Exception {
final DefaultConfiguration checkConfig =
Expand All @@ -46,7 +55,7 @@ public void testModifiedControlVariable() throws Exception {
"67:15: " + getCheckMessage(MSG_KEY, "i"),
"68:15: " + getCheckMessage(MSG_KEY, "k"),
};
verify(checkConfig, getPath("coding/InputModifiedControl.java"), expected);
verify(checkConfig, getPath("InputModifiedControl.java"), expected);
}

@Test
Expand All @@ -56,7 +65,7 @@ public void testEnhancedForLoopVariableTrue() throws Exception {
checkConfig.addAttribute("skipEnhancedForLoopVariable", "true");

final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputModifiedControlVariableEnhancedForLoopVariable.java"), expected);
verify(checkConfig, getPath("InputModifiedControlVariableEnhancedForLoopVariable.java"), expected);
}

@Test
Expand All @@ -67,7 +76,7 @@ public void testEnhancedForLoopVariableFalse() throws Exception {
final String[] expected = {
"9:18: " + getCheckMessage(MSG_KEY, "line"),
};
verify(checkConfig, getPath("coding/InputModifiedControlVariableEnhancedForLoopVariable.java"), expected);
verify(checkConfig, getPath("InputModifiedControlVariableEnhancedForLoopVariable.java"), expected);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test case file for FOR_ITERATION and whitespace.
// Created: 2003
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.coding;
package com.puppycrawl.tools.checkstyle.checks.coding;
import java.io.Serializable;
class InputModifiedControl
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.coding;
package com.puppycrawl.tools.checkstyle.checks.coding;

public class InputModifiedControlVariableEnhancedForLoopVariable {

Expand Down

0 comments on commit 11dc88a

Please sign in to comment.