VirtualMachineHandler { public Object attachVirtualMachine() { if (options.getPid() == null && options.getProcessPattern() == null) { return null; } Class vmClass = lookupVirtualMachineClass(); String pid = null; try { Method method = vmClass.getMethod("attach",String.class); pid = getProcessId(options); return method.invoke(null, pid); } catch (NoSuchMethodException e) { throw new ProcessingException("Internal: No method 'attach' found on " + vmClass,e,options); } catch (InvocationTargetException e) { throw new ProcessingException(getPidErrorMesssage(pid,"InvocationTarget",vmClass),e,options); } catch (IllegalAccessException e) { throw new ProcessingException(getPidErrorMesssage(pid, "IllegalAccessException", vmClass),e,options); } catch (IllegalArgumentException e) { throw new ProcessingException("Illegal Argument",e,options); } } VirtualMachineHandler(OptionsAndArgs pOptions); Object attachVirtualMachine(); void detachAgent(Object pVm); List<ProcessDescription> listProcesses(); ProcessDescription findProcess(Pattern pPattern);  }
@Test public void emptyPid() { assertNull(vmHandler.attachVirtualMachine()); }