Skip to content

Commit 2d817e5

Browse files
committed
Remove test-specific debug class
1 parent 86eeec2 commit 2d817e5

File tree

3 files changed

+13
-45
lines changed

3 files changed

+13
-45
lines changed

java/client/src/org/openqa/selenium/internal/Debug.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@
2626
*/
2727
public class Debug {
2828

29-
private static final boolean IS_DEBUG;
29+
private static boolean IS_DEBUG;
3030
static {
31-
IS_DEBUG = Boolean.getBoolean("selenium.webdriver.verbose") ||
32-
// Thanks https://stackoverflow.com/a/6865049
33-
ManagementFactory.getRuntimeMXBean().getInputArguments().toString().contains("-agentlib:jdwp");
31+
boolean debugFlag = ManagementFactory.getRuntimeMXBean().getInputArguments().stream()
32+
.map(str -> str.contains("-agentlib:jdwp"))
33+
.reduce(Boolean::logicalOr)
34+
.orElse(false);
35+
boolean simpleProperty = Boolean.getBoolean("selenium.debug");
36+
boolean longerProperty = Boolean.getBoolean("selenium.webdriver.verbose");
37+
38+
IS_DEBUG = debugFlag || simpleProperty || longerProperty;
3439
}
3540

3641
private Debug() {

java/client/test/org/openqa/selenium/build/Debug.java

-37
This file was deleted.

java/client/test/org/openqa/selenium/testing/CaptureLoggingRule.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
import static java.util.Collections.emptyList;
4141
import static java.util.stream.Collectors.toList;
42-
import static org.openqa.selenium.build.Debug.isDebug;
42+
import static org.openqa.selenium.internal.Debug.isDebugging;
4343

4444
public class CaptureLoggingRule implements TestRule {
4545
@Override
@@ -71,7 +71,7 @@ public void evaluate() throws Throwable {
7171
}
7272

7373
private List<Handler> beginLogCapture() {
74-
if (isDebug()) {
74+
if (isDebugging()) {
7575
return emptyList();
7676
}
7777

@@ -92,7 +92,7 @@ private List<Handler> beginLogCapture() {
9292
}
9393

9494
private void writeCapturedLogs() {
95-
if (isDebug()) {
95+
if (isDebugging()) {
9696
return;
9797
}
9898

@@ -104,7 +104,7 @@ private void writeCapturedLogs() {
104104
}
105105

106106
private void endLogCapture(List<Handler> handlers) {
107-
if (isDebug()) {
107+
if (isDebugging()) {
108108
return;
109109
}
110110

0 commit comments

Comments
 (0)