PagerDuty extends ServiceImpl implements CrashReportingService { PagerDutyEvent createEvent(StoredException storedException){ PagerDutyEvent pagerDutyEvent = new PagerDutyEvent(); pagerDutyEvent.service_key = apiKey; pagerDutyEvent.event_type = "trigger"; pagerDutyEvent.incident_key = storedException.message; pagerDutyEvent.description = storedException.stackTrace; return pagerDutyEvent; } PagerDuty(Context context); void enable(String apiKey); boolean isEnabled(); @Override ServiceType getServiceType(); void logEvent(StoredException storedException, Callback<Object> callback);  }
@Test public void testCreateEvent() { PagerDuty pagerDuty = new PagerDuty(null); pagerDuty.apiKey = "unit_test_api_key"; StoredException storedException = new StoredException(ServiceType.MIXPANEL, "test message", "test threadName", "test\nstack\ntrace"); PagerDuty.PagerDutyEvent pagerDutyEvent = pagerDuty.createEvent(storedException); assertEquals("unit_test_api_key", pagerDutyEvent.service_key); assertEquals("trigger", pagerDutyEvent.event_type); assertEquals("test message", pagerDutyEvent.incident_key); assertEquals("test\nstack\ntrace", pagerDutyEvent.description); }