001 package org.hackystat.sensor.ant.checkstyle; 002 003 import static org.junit.Assert.assertEquals; 004 005 import java.io.File; 006 import org.hackystat.sensor.ant.test.AntSensorTestHelper; 007 import org.junit.Test; 008 009 /** 010 * Tests the Ant CheckstyleSensor. 011 * 012 * @author Philip Johnson, Aaron A. Kagawa 013 */ 014 public class TestCheckstyleSensor extends AntSensorTestHelper { 015 016 /** 017 * Tests CheckstyleSensor by processing some test checkstyle files. 018 * @throws Exception If a problem occurs. 019 */ 020 @Test 021 public void testCheckstyleSensor() throws Exception { 022 CheckstyleSensor sensor = new CheckstyleSensor(host, user, user); 023 int instances = 0; 024 // Process the test files. 025 for (File file : super.getXmlFiles(System.getProperty("checkstyletestfiles"))) { 026 instances += sensor.processIssueXmlFile(file); 027 } 028 assertEquals("Should have 7 issues.", 7, instances); 029 } 030 }