Return-Path: X-Original-To: apmail-maven-commits-archive@www.apache.org Delivered-To: apmail-maven-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F3095184D9 for ; Wed, 30 Dec 2015 00:50:44 +0000 (UTC) Received: (qmail 1751 invoked by uid 500); 30 Dec 2015 00:50:44 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 1668 invoked by uid 500); 30 Dec 2015 00:50:44 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 1658 invoked by uid 99); 30 Dec 2015 00:50:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2015 00:50:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A8806E0547; Wed, 30 Dec 2015 00:50:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tibordigana@apache.org To: commits@maven.apache.org Date: Wed, 30 Dec 2015 00:50:44 -0000 Message-Id: <6223617dff8e4152b315021cfe71a59b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] maven-surefire git commit: [SUREFIRE] refactoring 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 Authored: Wed Dec 30 01:45:06 2015 +0100 Committer: Tibor17 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 ) );