From 4e1d336e514b981da1f5eef2a00aabfe54693537 Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Wed, 8 Mar 2023 10:24:01 +0100 Subject: [PATCH] Support integer properties in breakpoint comments in debugger tests GitOrigin-RevId: 27a65ac9b0ca9e4d3519d19b1d324d22eb5ff607 --- .../com/intellij/debugger/BreakpointComment.java | 14 ++++++++++++++ .../ExecutionWithDebuggerToolsTestCase.java | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/java/testFramework/src/com/intellij/debugger/BreakpointComment.java b/java/testFramework/src/com/intellij/debugger/BreakpointComment.java index 9f094df7b62a..b61ae49aa8fa 100644 --- a/java/testFramework/src/com/intellij/debugger/BreakpointComment.java +++ b/java/testFramework/src/com/intellij/debugger/BreakpointComment.java @@ -108,6 +108,20 @@ public final class BreakpointComment { throw error("Invalid boolean value '" + value + "' for '" + name + "'", index.get(name)); } + /** + * Reads a named integer property of the breakpoint. + */ + public @Nullable Integer readIntValue(@NotNull String name) { + String value = readValue(name); + if (value == null) return null; + try { + return Integer.parseInt(value); + } + catch (NumberFormatException e) { + throw error("Invalid integer value '" + value + "' for '" + name + "'", index.get(name)); + } + } + /** * Parses a string like {@code "Included,-ExceptionTest,-com.intellij.rt.*"} into * two lists of included and excluded class filters. diff --git a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java index 5b67d75ff507..cf529e4e02bb 100644 --- a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java +++ b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java @@ -446,10 +446,10 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa systemPrintln("LogExpression = " + logExpression); } - String passCount = comment.readValue("Pass count"); + Integer passCount = comment.readIntValue("Pass count"); if (passCount != null) { breakpoint.setCountFilterEnabled(true); - breakpoint.setCountFilter(Integer.parseInt(passCount)); + breakpoint.setCountFilter(passCount); systemPrintln("Pass count = " + passCount); }