/**
   * Tests if a MethodBreakPoint was moved appropriately.
   *
   * @throws Exception
   */
  public void testMethodBreakPoint() throws Exception {
    cleanTestFiles();
    IJavaProject javaProject = get14Project();
    ICompilationUnit cunit = getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
    IType type = cunit.getType("NonPublicType");

    try {
      // create an EntryMethod Breakpoint to test & do so
      createMethodBreakpoint(
          "a.b.c", "Movee.java", "NonPublicType", "nonPublicMethod", "()V", true, false);
      refactor(javaProject, type);
      IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints();
      assertEquals("wrong number of breakpoints", 1, breakpoints.length);
      IJavaMethodBreakpoint methodBreakpoint = (IJavaMethodBreakpoint) breakpoints[0];
      assertEquals("wrong type name", "a.b.MoveeRecipient", methodBreakpoint.getTypeName());
      assertEquals(
          "breakpoint attached to wrong method",
          "nonPublicMethod",
          methodBreakpoint.getMethodName());
    } catch (Exception e) {
      throw e;
    } finally {
      removeAllBreakpoints();
    }
  }
  /**
   * Handles the "stop-in-main" and "use-step-filter" option.
   *
   * @param events the debug events.
   * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[])
   */
  public void handleDebugEvents(DebugEvent[] events) {
    for (int i = 0; i < events.length; i++) {
      DebugEvent event = events[i];
      if (event.getKind() == DebugEvent.CREATE && event.getSource() instanceof IJavaDebugTarget) {

        IJavaDebugTarget target = (IJavaDebugTarget) event.getSource();
        ILaunch launch = target.getLaunch();
        if (launch != null) {
          ILaunchConfiguration configuration = launch.getLaunchConfiguration();
          if (configuration != null) {
            try {
              if (isStopInMain(configuration)) {
                String mainType = getMainTypeName(configuration);
                if (mainType != null) {
                  Map map = new HashMap();
                  map.put(
                      IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN,
                      IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN);

                  IJavaMethodBreakpoint bp =
                      JDIDebugModel.createMethodBreakpoint(
                          ResourcesPlugin.getWorkspace().getRoot(),
                          mainType,
                          "main", //$NON-NLS-1$
                          "([Ljava/lang/String;)V", //$NON-NLS-1$
                          true,
                          false,
                          false,
                          -1,
                          -1,
                          -1,
                          1,
                          false,
                          map); //$NON-NLS-1$
                  bp.setPersisted(false);
                  target.breakpointAdded(bp);
                }
              }
              if (isUseStepFilter(configuration)) {
                CjStepFilterOptionManager.getDefault().activateCaesarStepFilter(target);
              }
              DebugPlugin.getDefault().removeDebugEventListener(this);

            } catch (CoreException e) {
              LaunchingPlugin.log(e);
            }
          }
        }
      }
    }
  }