Author: rdonkin
Date: Fri Dec 6 09:47:45 2013
New Revision: 1548475
URL: http://svn.apache.org/r1548475
Log:
Apply PMD Rules.
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/DirectoryScanner.java
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java?rev=1548475&r1=1548474&r2=1548475&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
Fri Dec 6 09:47:45 2013
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTru
import java.io.BufferedReader;
import java.io.StringReader;
+import java.io.IOException;
import org.apache.rat.api.Document;
import org.apache.rat.document.MockLocation;
@@ -50,7 +51,7 @@ public class AppliedApacheSoftwareLicens
+ " * See the License for the specific language
governing permissions and\n"
+ " * limitations under the License.\n" + " */\n";
- AppliedApacheSoftwareLicense20 license;
+ private AppliedApacheSoftwareLicense20 license;
@Before
@@ -59,14 +60,14 @@ public class AppliedApacheSoftwareLicens
}
@Test
- public void match() throws Exception {
- BufferedReader in = new BufferedReader(new
StringReader(HEADER));
- String line = in.readLine();
+ public void match() throws IOException {
+ BufferedReader bufferedReader = new BufferedReader(new
StringReader(HEADER));
+ String line = bufferedReader.readLine();
boolean result = false;
final Document subject = new MockLocation("subject");
while (line != null) {
result = license.match(subject, line);
- line = in.readLine();
+ line = bufferedReader.readLine();
}
assertTrue("Applied AL2.0 license should be matched", result);
license.reset();
@@ -75,15 +76,15 @@ public class AppliedApacheSoftwareLicens
}
@Test
- public void noMatch() throws Exception {
- BufferedReader in = Resources
+ public void noMatch() throws IOException {
+ BufferedReader bufferedReader = Resources
.getBufferedResourceReader("elements/Source.java");
- String line = in.readLine();
+ String line = bufferedReader.readLine();
boolean result = false;
final Document subject = new MockLocation("subject");
while (line != null) {
result = license.match(subject, line);
- line = in.readLine();
+ line = bufferedReader.readLine();
}
assertFalse("Applied AL2.0 license should not be matched",
result);
license.reset();
@@ -91,13 +92,13 @@ public class AppliedApacheSoftwareLicens
@Test(timeout = 2000)
// may need to be adjusted if many more files are added
- public void goodFiles() throws Exception {
+ public void goodFiles() throws IOException {
DirectoryScanner.testFilesInDir("appliedAL20/good", license,
true);
}
@Test(timeout = 2000)
// may need to be adjusted if many more files are added
- public void baddFiles() throws Exception {
+ public void baddFiles() throws IOException {
DirectoryScanner.testFilesInDir("appliedAL20/bad", license,
false);
}
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/DirectoryScanner.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/DirectoryScanner.java?rev=1548475&r1=1548474&r2=1548475&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/DirectoryScanner.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/DirectoryScanner.java
Fri Dec 6 09:47:45 2013
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEqu
import java.io.BufferedReader;
import java.io.File;
+import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.apache.rat.analysis.IHeaderMatcher;
@@ -40,7 +41,7 @@ class DirectoryScanner {
* @param expected the expected result of the each scan
* @throws Exception
*/
- public static void testFilesInDir(String directory, IHeaderMatcher
matcher, boolean expected) throws Exception {
+ public static void testFilesInDir(String directory, IHeaderMatcher
matcher, boolean expected) throws IOException {
final File[] resourceFiles = Resources.getResourceFiles(directory);
if (resourceFiles.length == 0) {
Assert.fail("No files found under "+directory);