1+ /*******************************************************************************
2+ * Copyright (c) 2025 IBM Corporation and others.
3+ *
4+ * This program and the accompanying materials
5+ * are made available under the terms of the Eclipse Public License 2.0
6+ * which accompanies this distribution, and is available at
7+ * https://www.eclipse.org/legal/epl-2.0/
8+ *
9+ * SPDX-License-Identifier: EPL-2.0
10+ *
11+ * Contributors:
12+ * IBM Corporation - initial API and implementation
13+ *******************************************************************************/
14+ package org .eclipse .jdt .debug .tests .breakpoints ;
15+
16+ import org .eclipse .jdt .debug .core .IJavaLineBreakpoint ;
17+ import org .eclipse .jdt .debug .core .IJavaThread ;
18+ import org .eclipse .jdt .debug .tests .AbstractDebugTest ;
19+
20+ /**
21+ * Tests for disable on hit breakpoints.
22+ */
23+
24+ public class DisableOnHitTest extends AbstractDebugTest {
25+
26+ /**
27+ * Constructor
28+ *
29+ * @param name
30+ * the name of the test
31+ */
32+ public DisableOnHitTest (String name ) {
33+ super (name );
34+ }
35+
36+ public void testBreakpointHitWith () throws Exception {
37+ String typeName = "TriggerPoint_01" ;
38+ IJavaLineBreakpoint bp1 = createLineBreakpoint (19 , typeName );
39+ IJavaLineBreakpoint bp2 = createLineBreakpoint (20 , typeName );
40+ bp1 .setDisableOnHit (true );
41+ IJavaThread thread = null ;
42+ try {
43+ thread = launchToBreakpoint (typeName );
44+ thread .resume ();
45+ boolean isBp1Disabled = bp1 .isEnabled ();
46+ assertFalse ("Breakpoint should be disabled after hit" , isBp1Disabled );
47+ bp1 .delete ();
48+ bp2 .delete ();
49+ } finally {
50+ terminateAndRemove (thread );
51+ removeAllBreakpoints ();
52+ }
53+ }
54+
55+ public void testBreakpointHitWithout () throws Exception {
56+ String typeName = "TriggerPoint_01" ;
57+ IJavaLineBreakpoint bp1 = createLineBreakpoint (19 , typeName );
58+ IJavaLineBreakpoint bp2 = createLineBreakpoint (20 , typeName );
59+ IJavaThread thread = null ;
60+ try {
61+ thread = launchToBreakpoint (typeName );
62+ thread .resume ();
63+ boolean isBp1Disabled = bp1 .isEnabled ();
64+ assertTrue ("Breakpoint should be not be disabled after hit" , isBp1Disabled );
65+ bp1 .delete ();
66+ bp2 .delete ();
67+ } finally {
68+ terminateAndRemove (thread );
69+ removeAllBreakpoints ();
70+ }
71+ }
72+ }
0 commit comments