Cleanup code.
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1706618 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/shared/utils/introspection/IntrospectionException.java b/src/main/java/org/apache/maven/shared/utils/introspection/IntrospectionException.java
index 18ffe38..56200a4 100644
--- a/src/main/java/org/apache/maven/shared/utils/introspection/IntrospectionException.java
+++ b/src/main/java/org/apache/maven/shared/utils/introspection/IntrospectionException.java
@@ -23,6 +23,11 @@
extends Exception
{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6090771282553728784L;
+
public IntrospectionException( String message )
{
super( message );
diff --git a/src/main/java/org/apache/maven/shared/utils/introspection/MethodMap.java b/src/main/java/org/apache/maven/shared/utils/introspection/MethodMap.java
index 4d2521a..16df95c 100644
--- a/src/main/java/org/apache/maven/shared/utils/introspection/MethodMap.java
+++ b/src/main/java/org/apache/maven/shared/utils/introspection/MethodMap.java
@@ -143,6 +143,8 @@
static class AmbiguousException
extends Exception
{
+
+ private static final long serialVersionUID = 751688436639650618L;
}
diff --git a/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
index 10c5884..0f8b799 100644
--- a/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
@@ -28,12 +28,10 @@
import junit.framework.TestCase;
-@SuppressWarnings( { "JavaDoc", "deprecation" } )
public class CommandLineUtilsTest
extends TestCase
{
-
/**
* Tests that case-insensitive environment variables are normalized to upper case.
*/
diff --git a/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java b/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java
index 92a1466..e082617 100644
--- a/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java
@@ -26,7 +26,6 @@
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import junit.framework.Assert;
import junit.framework.TestCase;
/**
@@ -93,11 +92,11 @@
// Dependencies
// ----------------------------------------------------------------------
- List dependencies = (List) ReflectionValueExtractor.evaluate( "project.dependencies", project );
+ List<?> dependencies = (List<?>) ReflectionValueExtractor.evaluate( "project.dependencies", project );
- Assert.assertNotNull( dependencies );
+ assertNotNull( dependencies );
- Assert.assertEquals( 2, dependencies.size() );
+ assertEquals( 2, dependencies.size() );
// ----------------------------------------------------------------------
// Dependencies - using index notation
@@ -106,37 +105,37 @@
// List
Dependency dependency = (Dependency) ReflectionValueExtractor.evaluate( "project.dependencies[0]", project );
- Assert.assertNotNull( dependency );
+ assertNotNull( dependency );
- Assert.assertTrue( "dep1".equals( dependency.getArtifactId() ) );
+ assertTrue( "dep1".equals( dependency.getArtifactId() ) );
String artifactId = (String) ReflectionValueExtractor.evaluate( "project.dependencies[1].artifactId", project );
- Assert.assertTrue( "dep2".equals( artifactId ) );
+ assertTrue( "dep2".equals( artifactId ) );
// Array
dependency = (Dependency) ReflectionValueExtractor.evaluate( "project.dependenciesAsArray[0]", project );
- Assert.assertNotNull( dependency );
+ assertNotNull( dependency );
- Assert.assertTrue( "dep1".equals( dependency.getArtifactId() ) );
+ assertTrue( "dep1".equals( dependency.getArtifactId() ) );
artifactId = (String) ReflectionValueExtractor.evaluate( "project.dependenciesAsArray[1].artifactId", project );
- Assert.assertTrue( "dep2".equals( artifactId ) );
+ assertTrue( "dep2".equals( artifactId ) );
// Map
dependency = (Dependency) ReflectionValueExtractor.evaluate( "project.dependenciesAsMap(dep1)", project );
- Assert.assertNotNull( dependency );
+ assertNotNull( dependency );
- Assert.assertTrue( "dep1".equals( dependency.getArtifactId() ) );
+ assertTrue( "dep1".equals( dependency.getArtifactId() ) );
artifactId = (String) ReflectionValueExtractor.evaluate( "project.dependenciesAsMap(dep2).artifactId", project );
- Assert.assertTrue( "dep2".equals( artifactId ) );
+ assertTrue( "dep2".equals( artifactId ) );
// ----------------------------------------------------------------------
// Build
@@ -144,15 +143,15 @@
Build build = (Build) ReflectionValueExtractor.evaluate( "project.build", project );
- Assert.assertNotNull( build );
+ assertNotNull( build );
}
public void testValueExtractorWithAInvalidExpression()
throws Exception
{
- Assert.assertNull( ReflectionValueExtractor.evaluate( "project.foo", project ) );
- Assert.assertNull( ReflectionValueExtractor.evaluate( "project.dependencies[10]", project ) );
- Assert.assertNull( ReflectionValueExtractor.evaluate( "project.dependencies[0].foo", project ) );
+ assertNull( ReflectionValueExtractor.evaluate( "project.foo", project ) );
+ assertNull( ReflectionValueExtractor.evaluate( "project.dependencies[10]", project ) );
+ assertNull( ReflectionValueExtractor.evaluate( "project.dependencies[0].foo", project ) );
}
public void testMappedDottedKey()
@@ -161,7 +160,7 @@
Map<String, String> map = new HashMap<String, String>();
map.put( "a.b", "a.b-value" );
- Assert.assertEquals( "a.b-value", ReflectionValueExtractor.evaluate("h.value(a.b)", new ValueHolder(map)) );
+ assertEquals( "a.b-value", ReflectionValueExtractor.evaluate("h.value(a.b)", new ValueHolder(map)) );
}
public void testIndexedMapped()
@@ -172,7 +171,7 @@
List<Object> list = new ArrayList<Object>();
list.add( map );
- Assert.assertEquals( "a-value", ReflectionValueExtractor.evaluate("h.value[0](a)", new ValueHolder(list)) );
+ assertEquals( "a-value", ReflectionValueExtractor.evaluate("h.value[0](a)", new ValueHolder(list)) );
}
public void testMappedIndexed()
@@ -182,7 +181,7 @@
list.add( "a-value" );
Map<Object, Object> map = new HashMap<Object, Object>();
map.put( "a", list );
- Assert.assertEquals( "a-value", ReflectionValueExtractor.evaluate("h.value(a)[0]", new ValueHolder(map)) );
+ assertEquals( "a-value", ReflectionValueExtractor.evaluate("h.value(a)[0]", new ValueHolder(map)) );
}
public void testMappedMissingDot()
@@ -190,7 +189,7 @@
{
Map<Object, Object> map = new HashMap<Object, Object>();
map.put( "a", new ValueHolder( "a-value" ) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value(a)value", new ValueHolder(map)) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value(a)value", new ValueHolder(map)) );
}
public void testIndexedMissingDot()
@@ -198,13 +197,13 @@
{
List<Object> list = new ArrayList<Object>();
list.add( new ValueHolder( "a-value" ) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[0]value", new ValueHolder(list)) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[0]value", new ValueHolder(list)) );
}
public void testDotDot()
throws Exception
{
- Assert.assertNull( ReflectionValueExtractor.evaluate("h..value", new ValueHolder("value")) );
+ assertNull( ReflectionValueExtractor.evaluate("h..value", new ValueHolder("value")) );
}
public void testBadIndexedSyntax()
@@ -214,12 +213,12 @@
list.add( "a-value" );
Object value = new ValueHolder( list );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[]", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[a]", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[0", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[0)", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value[-1]", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[]", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[a]", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[0", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[0)", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value[-1]", value) );
}
public void testBadMappedSyntax()
@@ -229,10 +228,10 @@
map.put( "a", "a-value" );
Object value = new ValueHolder( map );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value(", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value()", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value(a", value) );
- Assert.assertNull( ReflectionValueExtractor.evaluate("h.value(a]", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value(", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value()", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value(a", value) );
+ assertNull( ReflectionValueExtractor.evaluate("h.value(a]", value) );
}
public void testIllegalIndexedType()
@@ -264,7 +263,7 @@
public void testTrimRootToken()
throws Exception
{
- Assert.assertNull( ReflectionValueExtractor.evaluate("project", project, true) );
+ assertNull( ReflectionValueExtractor.evaluate("project", project, true) );
}
public void testArtifactMap()
diff --git a/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java b/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java
index d5f7663..e331db9 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java
@@ -131,6 +131,8 @@
ds.scan();
String[] includedDirectories = ds.getIncludedDirectories();
String[] files = ds.getIncludedFiles();
+
+ //FIXME: This should be changed to some kind of assert...WhatEver()...
System.out.println( "files = " + files );
diff --git a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
index c583b79..57e3033 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
@@ -1,5 +1,30 @@
package org.apache.maven.shared.utils.io;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeThat;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -29,31 +54,6 @@
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeThat;
-import static org.junit.Assume.assumeTrue;
-import static org.junit.matchers.JUnitMatchers.containsString;
-import static org.junit.matchers.JUnitMatchers.hasItems;
-
/**
* This is used to test FileUtils for correctness.
*
@@ -1050,7 +1050,6 @@
assertThat( actual, is( expected ) );
}
- @SuppressWarnings("ConstantConditions")
@Test( expected = NullPointerException.class )
public void blowUpOnNull()
throws IOException
diff --git a/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java b/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java
index ddb6a94..ef99a03 100644
--- a/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java
@@ -1128,7 +1128,7 @@
public void getMethodObjectNullNull()
throws Exception
{
- reflector.getMethod( Object.class, null, null );
+ reflector.getMethod( Object.class, (String)null, (Class<?>)null );
}
@Test( expected = NullPointerException.class )
diff --git a/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTestHelper.java b/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTestHelper.java
index 0cd6445..544df29 100644
--- a/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTestHelper.java
+++ b/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTestHelper.java
@@ -24,7 +24,6 @@
*/
class ReflectorTestHelper
{
- private static String PRIVATE_STATIC_STRING = "private static string";
static String PACKAGE_STATIC_STRING = "package static string";
protected static String PROTECTED_STATIC_STRING = "protected static string";
public static String PUBLIC_STATIC_STRING = "public static string";
@@ -57,11 +56,6 @@
}
}
- private static ReflectorTestHelper getInstance()
- {
- return new ReflectorTestHelper();
- }
-
static ReflectorTestHelper getInstance( Boolean throwSomething )
{
if ( Boolean.TRUE.equals( throwSomething ) )
@@ -97,6 +91,11 @@
public static class HelperException
extends RuntimeException
{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3395757415194358525L;
+
public HelperException()
{
super(); //To change body of overridden methods use File | Settings | File Templates.