[testng] 79/160: Refactor
Eugene Zhukov
eugene-guest at moszumanska.debian.org
Tue Aug 18 10:22:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
eugene-guest pushed a commit to annotated tag testng-6.9.5
in repository testng.
commit 5a9f86fe8f83805e79c57cd62928ae1dc34a5584
Author: Julien Herr <julien.herr at alcatel-lucent.com>
Date: Thu Jun 4 15:09:17 2015 +0200
Refactor
---
.../internal/AbstractExpectedExceptionsHolder.java | 15 ++++++++------
.../testng/internal/ExpectedExceptionsHolder.java | 23 +++++++++++-----------
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/testng/internal/AbstractExpectedExceptionsHolder.java b/src/main/java/org/testng/internal/AbstractExpectedExceptionsHolder.java
index 183547d..b2e68f7 100644
--- a/src/main/java/org/testng/internal/AbstractExpectedExceptionsHolder.java
+++ b/src/main/java/org/testng/internal/AbstractExpectedExceptionsHolder.java
@@ -21,16 +21,19 @@ public abstract class AbstractExpectedExceptionsHolder {
}
private static Class<?>[] findExpectedClasses(IAnnotationFinder finder, ITestNGMethod method) {
- IExpectedExceptionsAnnotation expectedExceptions = finder.findAnnotation(method, IExpectedExceptionsAnnotation.class);
+ IExpectedExceptionsAnnotation expectedExceptions =
+ finder.findAnnotation(method, IExpectedExceptionsAnnotation.class);
// Old syntax
if (expectedExceptions != null) {
return expectedExceptions.getValue();
- } else { // New syntax
- ITestAnnotation testAnnotation = finder.findAnnotation(method, ITestAnnotation.class);
- if (testAnnotation != null) {
- return testAnnotation.getExpectedExceptions();
- }
}
+
+ // New syntax
+ ITestAnnotation testAnnotation = finder.findAnnotation(method, ITestAnnotation.class);
+ if (testAnnotation != null) {
+ return testAnnotation.getExpectedExceptions();
+ }
+
return new Class<?>[0];
}
diff --git a/src/main/java/org/testng/internal/ExpectedExceptionsHolder.java b/src/main/java/org/testng/internal/ExpectedExceptionsHolder.java
index 1a7ea7c..2ae74b4 100755
--- a/src/main/java/org/testng/internal/ExpectedExceptionsHolder.java
+++ b/src/main/java/org/testng/internal/ExpectedExceptionsHolder.java
@@ -42,21 +42,22 @@ public class ExpectedExceptionsHolder extends AbstractExpectedExceptionsHolder {
}
private String getRegExp() {
- String messageRegExp = DEFAULT_REGEXP;
IExpectedExceptionsAnnotation expectedExceptions =
finder.findAnnotation(method, IExpectedExceptionsAnnotation.class);
+ if (expectedExceptions != null) {
+ // Old syntax => default value
+ return DEFAULT_REGEXP;
+ }
- if (expectedExceptions == null) {
- // New syntax
- ITestAnnotation testAnnotation = finder.findAnnotation(method, ITestAnnotation.class);
- if (testAnnotation != null) {
- Class<?>[] ee = testAnnotation.getExpectedExceptions();
- if (ee.length > 0) {
- messageRegExp = testAnnotation.getExpectedExceptionsMessageRegExp();
- }
+ // New syntax
+ ITestAnnotation testAnnotation = finder.findAnnotation(method, ITestAnnotation.class);
+ if (testAnnotation != null) {
+ Class<?>[] ee = testAnnotation.getExpectedExceptions();
+ if (ee.length > 0) {
+ return testAnnotation.getExpectedExceptionsMessageRegExp();
}
- } // else: Old syntax => keep default value
+ }
- return messageRegExp;
+ return DEFAULT_REGEXP;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git
More information about the pkg-java-commits
mailing list