Skip to content

Commit

Permalink
Simplify DisableOnDebug and ParentRunner
Browse files Browse the repository at this point in the history
 - DisableOnDebug: merge two if branches with the same implementation
   (`return true` in the both branches).
 - Use `Collections.singletonList` instead of `Arrays.asList` since it
   contains only one item.
  • Loading branch information
renuka-fernando authored and marcphilipp committed Oct 3, 2018
1 parent 4c4663f commit e794f9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/junit/rules/DisableOnDebug.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ public Statement apply(Statement base, Description description) {
*/
private static boolean isDebugging(List<String> arguments) {
for (final String argument : arguments) {
if ("-Xdebug".equals(argument)) {
return true;
} else if (argument.startsWith("-agentlib:jdwp")) {
if ("-Xdebug".equals(argument) || argument.startsWith("-agentlib:jdwp")) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/junit/runners/ParentRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
*/
public abstract class ParentRunner<T> extends Runner implements Filterable,
Orderable {
private static final List<TestClassValidator> VALIDATORS = Arrays.<TestClassValidator>asList(
private static final List<TestClassValidator> VALIDATORS = Collections.<TestClassValidator>singletonList(
new AnnotationsValidator());

private final Lock childrenLock = new ReentrantLock();
Expand Down

0 comments on commit e794f9a

Please sign in to comment.