eventManager.start();
}
private <T extends VmEvent> T getVmEvent(final String id, Class<T> eventClass) {
T e = Mockito.mock(eventClass);
VmEventArgument ea = Mockito.mock(VmEventArgument.class);
Mockito.when(e.getVm()).thenReturn(ea);
Mockito.when(ea.getVm()).thenAnswer(new Answer<ManagedObjectReference>() {
public ManagedObjectReference answer(InvocationOnMock invocation) throws Throwable {
ManagedObjectReference moRef = Mockito.mock(ManagedObjectReference.class);
Mockito.when(moRef.getServerGuid()).thenReturn(null);
Mockito.when(moRef.getType()).thenReturn("VirtualMachine");
Mockito.when(moRef.getValue()).thenReturn(id);