Wraps the static code analyze tool Checkstyle into a simple JUnit test.
Download the latest version here: https://github.com/corgrath/JUnit-Checkstyle-Test-Wrapper/downloads/
Download the latest version of JUnit Checkstyle Test Wrapper and add it to the project.
Download the latest version of Checkstyle and add it to the project.
Download Checkstyle from: https://sourceforge.net/projects/checkstyle/files/
Write a JUnit test case using the wrapper.
import org.junit.Test;
import com.osbcp.junitcheckstyletestwrapper.JUnitCheckstyleTestWrapper;
public class TestCheckstyle {
@Test
public void testSrc() throws Exception {
JUnitCheckstyleTestWrapper.run(this, "./src/", "checkstyle.xml");
}
}
Create a Checkstyle rule set file and add it in the same folder as the test.
Guide: http://checkstyle.sourceforge.net/availablechecks.html
Or download our sample file: https://github.com/corgrath/JUnit-Checkstyle-Test-Wrapper/raw/master/doc/wiki/checkstyle.xml
http://dl.dropbox.com/u/8183146/persistent/projects/java_junit_checkstyle_wrapper/javadoc/index.html
JUnit Checkstyle Test Wrapper - Copyright 2011 Christoffer Pettersson, [email protected]
Licensed under the Apache License, Version 2.0