001 package org.hackystat.sensor.ant.pmd; 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 Pmd sensor. 011 * 012 * @author Philip Johnson, Aaron A. Kagawa 013 */ 014 public class TestPmdSensor extends AntSensorTestHelper { 015 016 /** 017 * Tests Sensor by processing some test files. 018 * @throws Exception If a problem occurs. 019 */ 020 @Test 021 public void testPmdSensor() throws Exception { 022 PmdSensor sensor = new PmdSensor(host, user, user); 023 sensor.setVerbose("off"); 024 int instances = 0; 025 // Process the test files. 026 for (File file : super.getXmlFiles(System.getProperty("pmdtestfiles"))) { 027 instances += sensor.processPmdXmlFile(file); 028 } 029 assertEquals("Should have 6 entries.", 6, instances); 030 } 031 }