@Test(timeout = 5000)
public void testCreateChange() throws Exception {
final String[] resultMessage = new String[1];
final Breakpoint[] resultBreakpoint = new Breakpoint[1];
Breakpoint breakpoint;
{
final CountDownLatch latch = new CountDownLatch(1);
// The "create" part
javascriptVm.setBreakpoint(new Breakpoint.Target.ScriptName("1"), 4, 1, true, "false",
new BreakpointCallback() {
public void failure(String errorMessage) {
resultMessage[0] = errorMessage;
latch.countDown();
}
public void success(Breakpoint breakpoint) {
resultBreakpoint[0] = breakpoint;
latch.countDown();
}
},
null);
latch.await();
assertNull(resultMessage[0], resultMessage[0]);
assertNotNull(resultBreakpoint[0]);
breakpoint = resultBreakpoint[0];
assertEquals("false", breakpoint.getCondition());
assertTrue(breakpoint.isEnabled());
}
// The "change" part
breakpoint.setCondition("true");
breakpoint.setEnabled(false);
resultBreakpoint[0] = null;
final CountDownLatch latch2 = new CountDownLatch(1);
breakpoint.flush(new BreakpointCallback() {
public void failure(String errorMessage) {
resultMessage[0] = errorMessage;
latch2.countDown();
}