maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [1/2] maven-surefire git commit: [SUREFIRE] refactoring
Date Wed, 30 Dec 2015 00:50:44 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master 378097657 -> 3066272ef


[SUREFIRE] refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/7969ee4e
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7969ee4e
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7969ee4e

Branch: refs/heads/master
Commit: 7969ee4e98d7fc95949a13860b7b47d40b154bce
Parents: 3780976
Author: Tibor17 <tibor17@lycos.com>
Authored: Wed Dec 30 01:45:06 2015 +0100
Committer: Tibor17 <tibor17@lycos.com>
Committed: Wed Dec 30 01:45:06 2015 +0100

----------------------------------------------------------------------
 .../group/match/SingleGroupMatcher.java         | 20 ++------------------
 .../common/junit48/JUnit48Reflector.java        |  8 ++++----
 .../common/junit48/JUnit48ReflectorTest.java    |  6 ++----
 3 files changed, 8 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7969ee4e/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java
----------------------------------------------------------------------
diff --git a/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java
b/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java
index 69517f9..f03a7c4 100644
--- a/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java
+++ b/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java
@@ -54,7 +54,7 @@ public class SingleGroupMatcher
     {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ( enabled == null ? 0 : enabled.hashCode() );
+        result = prime * result + enabled.hashCode();
         return result;
     }
 
@@ -74,18 +74,7 @@ public class SingleGroupMatcher
             return false;
         }
         SingleGroupMatcher other = (SingleGroupMatcher) obj;
-        if ( enabled == null )
-        {
-            if ( other.enabled != null )
-            {
-                return false;
-            }
-        }
-        else if ( !enabled.equals( other.enabled ) )
-        {
-            return false;
-        }
-        return true;
+        return enabled.equals( other.enabled );
     }
 
     @Override
@@ -118,11 +107,6 @@ public class SingleGroupMatcher
 
     public boolean enabled( String... cats )
     {
-        if ( enabled == null )
-        {
-            return true;
-        }
-
         for ( String cat : cats )
         {
             if ( cat == null || cat.trim().length() < 1 )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7969ee4e/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/JUnit48Reflector.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/JUnit48Reflector.java
b/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/JUnit48Reflector.java
index 3878922..d7f9583 100644
--- a/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/JUnit48Reflector.java
+++ b/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/JUnit48Reflector.java
@@ -19,7 +19,7 @@ package org.apache.maven.surefire.common.junit48;
  * under the License.
  */
 
-import org.apache.maven.surefire.util.ReflectionUtils;
+import static org.apache.maven.surefire.util.ReflectionUtils.tryLoadClass;
 
 /**
  * @author Kristian Rosenvold
@@ -36,8 +36,8 @@ public final class JUnit48Reflector
 
     public JUnit48Reflector( ClassLoader testClassLoader )
     {
-        categories = ReflectionUtils.tryLoadClass( testClassLoader, CATEGORIES );
-        category = ReflectionUtils.tryLoadClass( testClassLoader, CATEGORY );
+        categories = tryLoadClass( testClassLoader, CATEGORIES );
+        category = tryLoadClass( testClassLoader, CATEGORY );
     }
 
     public boolean isJUnit48Available()
@@ -45,7 +45,7 @@ public final class JUnit48Reflector
         return categories != null;
     }
 
-    public boolean isCategoryAnnotationPresent( Class clazz )
+    boolean isCategoryAnnotationPresent( Class clazz )
     {
         return clazz != null && category != null
                && ( clazz.getAnnotation( category ) != null || isCategoryAnnotationPresent(
clazz.getSuperclass() ) );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7969ee4e/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit48ReflectorTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit48ReflectorTest.java
b/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit48ReflectorTest.java
index fe4a884..3203202 100644
--- a/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit48ReflectorTest.java
+++ b/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit48ReflectorTest.java
@@ -29,16 +29,14 @@ public class JUnit48ReflectorTest
     extends TestCase
 {
     public void testIsJUnit48Available()
-        throws Exception
     {
-        JUnit48Reflector jUnit48Reflector = new JUnit48Reflector( this.getClass().getClassLoader()
);
+        JUnit48Reflector jUnit48Reflector = new JUnit48Reflector( getClass().getClassLoader()
);
         assertTrue( jUnit48Reflector.isJUnit48Available() );
     }
 
     public void testCategoryAnnotation()
-        throws Exception
     {
-        JUnit48Reflector jUnit48Reflector = new JUnit48Reflector( this.getClass().getClassLoader()
);
+        JUnit48Reflector jUnit48Reflector = new JUnit48Reflector( getClass().getClassLoader()
);
         assertTrue( jUnit48Reflector.isCategoryAnnotationPresent( Test1.class ) );
         assertTrue( jUnit48Reflector.isCategoryAnnotationPresent( Test3.class ) );
         assertFalse( jUnit48Reflector.isCategoryAnnotationPresent( Test2.class ) );


Mime
View raw message