Issue #1555: Replace constructor with setUp() in JUnit test case

Fixes `TestCaseWithConstructor` inspection violations.

Description:
>Reports on JUnit test cases with initialization logic in their constructors. Initialization of JUnit test cases should be done in setUp() methods instead.
This commit is contained in:
Michal Kordas 2015-08-31 23:26:48 +02:00 committed by Roman Ivanov
parent 5a46bdbeea
commit 5c5eafaa7e
1 changed files with 5 additions and 4 deletions

View File

@ -26,6 +26,7 @@ import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,11 +37,11 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtils;
public class TypeNameCheckTest
extends BaseCheckTestSupport {
private final String inputFilename;
private String inputFilename;
public TypeNameCheckTest() throws IOException {
inputFilename = getPath("naming" + File.separator
+ "InputTypeName.java");
@Before
public void setUp() throws IOException {
inputFilename = getPath("naming" + File.separator + "InputTypeName.java");
}
@Test