public void testSimpleKotlinFileBreakpointRegister() { KtFile ktFile = mock(KtFile.class); when(ktFile.getFileType()).thenReturn(KotlinFileType.INSTANCE); registerMockBreakpoint( ktFile, new String[] {"foowatch1"}, "condition == true", 123, "foo.java", "com.google", false, "b_id"); assertNull(removedBp.get()); assertNotNull(addedBp.get()); assertContainsElements(addedBp.get().getExpressions(), "foowatch1"); assertTrue(addedBp.get().getLocation().getLine() == 124); assertTrue(addedBp.get().getLocation().getPath().equals("com/google/foo.java")); assertTrue(addedBp.get().getCondition().equals("condition == true")); ArgumentCaptor<CloudLineBreakpoint> breakpointArgumentCaptor = ArgumentCaptor.forClass(CloudLineBreakpoint.class); verify(process).updateBreakpointPresentation(breakpointArgumentCaptor.capture()); assertThat(breakpointArgumentCaptor.getValue().getErrorMessage(), nullValue()); }
public void testSimpleJavaFileBreakpointRegister() { registerMockBreakpoint( psiJavaFile, new String[] {"foowatch1"}, "condition == true", 123, "foo.java", "com.google", false, "b_id"); assertNull(removedBp.get()); assertNotNull(addedBp.get()); assertContainsElements(addedBp.get().getExpressions(), "foowatch1"); assertTrue(addedBp.get().getLocation().getLine() == 124); assertTrue(addedBp.get().getLocation().getPath().equals("com/google/foo.java")); assertTrue(addedBp.get().getCondition().equals("condition == true")); ArgumentCaptor<CloudLineBreakpoint> breakpointArgumentCaptor = ArgumentCaptor.forClass(CloudLineBreakpoint.class); verify(process).updateBreakpointPresentation(breakpointArgumentCaptor.capture()); assertThat(breakpointArgumentCaptor.getValue().getErrorMessage(), nullValue()); }
public void testConflictingRegister() { Breakpoint existingServerBp = new Breakpoint(); SourceLocation location = new SourceLocation(); location.setPath("com/google/foo.java"); location.setLine(124); existingServerBp.setLocation(location); existingServerBp.setId("todelete"); existingBreakpoints.add(existingServerBp); registerMockBreakpoint( psiJavaFile, new String[] {"foowatch1"}, "condition == true", 123, "foo.java", "com.google", false, "b_id"); existingBreakpoints.clear(); assertNotNull(addedBp.get()); assertContainsElements(addedBp.get().getExpressions(), "foowatch1"); assertTrue(addedBp.get().getLocation().getLine() == 124); assertTrue(addedBp.get().getLocation().getPath().equals("com/google/foo.java")); assertTrue(addedBp.get().getCondition().equals("condition == true")); }
@SuppressWarnings("unchecked") public void testUnregisterBreakpoint_shouldSetAddedOnServerToFalseAfterClientDisablesBp() throws Exception { XLineBreakpointImpl breakpoint = registerMockBreakpoint( psiJavaFile, NO_WATCHES, NO_CONDITION, 13, "fileName", "packageName", false, "12abc"); assertNotNull(breakpoint.getProperties()); assertTrue(((CloudLineBreakpointProperties) breakpoint.getProperties()).isAddedOnServer()); handler.unregisterBreakpoint(breakpoint, false); assertFalse(((CloudLineBreakpointProperties) breakpoint.getProperties()).isAddedOnServer()); verify(stateController).deleteBreakpointAsync("12abc"); }
@SuppressWarnings("unchecked") public void testUnregisterBreakpoint_shouldSetAddedOnServerToFalseAfterHitOnBackend() throws Exception { XLineBreakpointImpl breakpoint = registerMockBreakpoint( psiJavaFile, NO_WATCHES, NO_CONDITION, 13, "fileName", "packageName", false, "12abc"); handler.setStateToDisabled(new Breakpoint().setId("12abc")); assertNotNull(breakpoint.getProperties()); assertTrue(((CloudLineBreakpointProperties) breakpoint.getProperties()).isAddedOnServer()); handler.unregisterBreakpoint(breakpoint, false); assertFalse(((CloudLineBreakpointProperties) breakpoint.getProperties()).isAddedOnServer()); verify(stateController, never()).deleteBreakpointAsync("12abc"); }
public void testRegisterGetAndDelete() { registerMockBreakpoint( psiJavaFile, new String[] {"foowatch1"}, "condition == true", 123, "foo.java", "com.google", false, "b_id"); assertNull(removedBp.get()); assertNotNull(addedBp.get()); assertContainsElements(addedBp.get().getExpressions(), "foowatch1"); assertTrue(addedBp.get().getLocation().getLine() == 124); assertTrue(addedBp.get().getLocation().getPath().equals("com/google/foo.java")); assertTrue(addedBp.get().getCondition().equals("condition == true")); addedBp.get().setId("b_id"); XBreakpoint xideBreakpoint = handler.getXBreakpoint(addedBp.get()); assertNotNull(xideBreakpoint); handler.deleteBreakpoint(addedBp.get()); assertNotNull(removedBp.get()); assertTrue(removedBp.get().equals(addedBp.get().getId())); }