protected CloudTrailEvent getMockedEvent() { CloudTrailEvent event = Mockito.mock(CloudTrailEvent.class); CloudTrailEventData eventData = Mockito.mock(CloudTrailEventData.class); Mockito.when(event.getEventData()).thenReturn(eventData); Mockito.when(eventData.getEventSource()).thenReturn("ec2.amazonaws.com"); Mockito.when(eventData.getEventName()).thenReturn("RunInstances"); return event; }
/** We use this as a filter for events. */ @Override public boolean supports(final CloudTrailEvent event) { CloudTrailEventData eventData = event.getEventData(); String eventSource = eventData.getEventSource(); String eventName = eventData.getEventName(); return eventSource.equals(EC2_EVENTS) && eventName.startsWith(DELETE); }