WrapperSdkExceptionManager { public static ErrorReport buildHandledErrorReport(Context context, String errorReportId) { ErrorReport report = new ErrorReport(); report.setId(errorReportId); report.setAppErrorTime(new Date()); report.setAppStartTime(new Date(Crashes.getInstance().getInitializeTimestamp())); try { report.setDevice(Crashes.getInstance().getDeviceInfo(context)); } catch (DeviceInfoHelper.DeviceInfoException e) { AppCenterLog.warn(LOG_TAG, "Handled error report cannot get device info, errorReportId=" + errorReportId); } return report; } @VisibleForTesting  WrapperSdkExceptionManager(); static UUID saveWrapperException(Thread thread, Throwable throwable, com.microsoft.appcenter.crashes.ingestion.models.Exception modelException, String rawSerializedException); static void deleteWrapperExceptionData(UUID errorId); static String loadWrapperExceptionData(UUID errorId); static String trackException(com.microsoft.appcenter.crashes.ingestion.models.Exception modelException, Map<String, String> properties, Iterable<ErrorAttachmentLog> attachments); static void setAutomaticProcessing(@SuppressWarnings("SameParameterValue") boolean automaticProcessing); static AppCenterFuture<Collection<ErrorReport>> getUnprocessedErrorReports(); static AppCenterFuture<Boolean> sendCrashReportsOrAwaitUserConfirmation(Collection<String> filteredReportIds); static ErrorReport buildHandledErrorReport(Context context, String errorReportId); static void sendErrorAttachments(String errorReportId, Iterable<ErrorAttachmentLog> attachments);  }
@Test @PrepareForTest(DeviceInfoHelper.class) public void handledErrorReportFailedToGetDeviceInfo() throws DeviceInfoHelper.DeviceInfoException { mockStatic(DeviceInfoHelper.class); when(DeviceInfoHelper.getDeviceInfo(any(Context.class))).thenThrow(new DeviceInfoHelper.DeviceInfoException("mock", new java.lang.Exception())); String errorReportId = UUID.randomUUID().toString(); ErrorReport errorReport = WrapperSdkExceptionManager.buildHandledErrorReport(mock(Context.class), errorReportId); assertNotNull(errorReport); assertEquals(errorReportId, errorReport.getId()); assertNotNull(errorReport.getAppErrorTime()); assertNotNull(errorReport.getAppStartTime()); assertNull(errorReport.getDevice()); }