-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the issues to set conditional breakpoint in java.io.File class
- Loading branch information
Showing
4 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
org.eclipse.jdt.debug.tests/testprograms/FileConditionSnippet2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import java.io.File; | ||
|
||
public class FileConditionSnippet2 { | ||
public static void main(String[] ecs) { | ||
int i = 0; | ||
File parent = new File("parent"); | ||
File file = new File(parent,"test"); | ||
System.out.println("COMPLETED"); | ||
} | ||
|
||
} | ||
|
||
///////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...ts/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsWithFileClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.eclipse.jdt.debug.tests.breakpoints; | ||
|
||
import org.eclipse.jdt.debug.core.IJavaLineBreakpoint; | ||
import org.eclipse.jdt.debug.core.IJavaThread; | ||
import org.eclipse.jdt.debug.tests.AbstractDebugTest; | ||
|
||
public class ConditionalBreakpointsWithFileClass extends AbstractDebugTest { | ||
|
||
public ConditionalBreakpointsWithFileClass(String name) { | ||
super(name); | ||
} | ||
|
||
public void testFileConditionalBreakpointForTrue() throws Exception { | ||
String typeName = "FileConditionSnippet2"; | ||
IJavaLineBreakpoint bp = createLineBreakpoint(7, typeName); | ||
createConditionalLineBreakpoint(374, "java.io.File", "child.equals(\"test\")", true); | ||
|
||
IJavaThread mainThread = null; | ||
try { | ||
mainThread = launchToLineBreakpoint(typeName, bp); | ||
mainThread.resume(); | ||
Thread.sleep(100); | ||
int hitLine = 0; | ||
if (mainThread.isSuspended()) { | ||
hitLine = mainThread.getStackFrames()[0].getLineNumber(); | ||
} | ||
assertTrue("Should hit", (hitLine == 374) && (mainThread.isSuspended() == true)); | ||
} finally { | ||
bp.delete(); | ||
terminateAndRemove(mainThread); | ||
removeAllBreakpoints(); | ||
} | ||
} | ||
|
||
public void testFileConditionalBreakpointForFalse() throws Exception { | ||
String typeName = "FileConditionSnippet2"; | ||
IJavaLineBreakpoint bp = createLineBreakpoint(7, typeName); | ||
createConditionalLineBreakpoint(374, "java.io.File", "child.equals(\"test2\")", true); | ||
|
||
IJavaThread mainThread = null; | ||
try { | ||
mainThread = launchToLineBreakpoint(typeName, bp); | ||
mainThread.resume(); | ||
Thread.sleep(100); | ||
int hitLine = 0; | ||
if (mainThread.isSuspended()) { | ||
hitLine = mainThread.getStackFrames()[0].getLineNumber(); | ||
} | ||
assertFalse("Should hit", (hitLine == 374) && (mainThread.isSuspended() == true)); | ||
} finally { | ||
bp.delete(); | ||
terminateAndRemove(mainThread); | ||
removeAllBreakpoints(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters