### Question:
EventRecorder { void buildEventPayload(AnalyticsEvent internalEvent, Event event) { final Session session = new Session(); session.withId(internalEvent.getSession().getSessionId()); session.withStartTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getSession().getSessionStart()))); if (internalEvent.getSession().getSessionStop() != null && internalEvent.getSession().getSessionStop() != 0L) { session.withStopTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getSession().getSessionStop()))); } if (internalEvent.getSession().getSessionDuration() != null && internalEvent.getSession().getSessionDuration() != 0L) { session.withDuration(internalEvent.getSession().getSessionDuration().intValue()); } final AndroidAppDetails appDetails = internalEvent.getAppDetails(); event.withAppPackageName(appDetails.packageName()) .withAppTitle(appDetails.getAppTitle()) .withAppVersionCode(appDetails.versionCode()) .withAttributes(internalEvent.getAllAttributes()) .withClientSdkVersion(internalEvent.getSdkVersion()) .withEventType(internalEvent.getEventType()) .withMetrics(internalEvent.getAllMetrics()) .withSdkName(internalEvent.getSdkName()) .withSession(session) .withTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getEventTimestamp()))); } EventRecorder(final PinpointContext pinpointContext,
                  final PinpointDBUtil dbUtil,
                  final ExecutorService submissionRunnableQueue); static EventRecorder newInstance(final PinpointContext pinpointContext); static EventRecorder newInstance(final PinpointContext pinpointContext, final PinpointDBUtil dbUtil); static void setClippedEventLength(final int clippedEventLength); void closeDB(); Uri recordEvent(final AnalyticsEvent event); void submitEvents(); List<JSONObject> getAllEvents();  }### Answer:
@Test public void testRecordEventPayload() throws JSONException { final Event event = new Event(); eventRecorder.buildEventPayload(analyticsEvent, event); final MockAppDetails mockAppDetails = new MockAppDetails(); assertEquals(mockAppDetails.packageName(), event.getAppPackageName()); assertEquals(mockAppDetails.getAppTitle(), event.getAppTitle()); assertEquals(mockAppDetails.versionCode(), event.getAppVersionCode()); assertEquals(EVENT_NAME, event.getEventType()); assertEquals(SDK_NAME, event.getSdkName()); assertEquals(SDK_VERSION, event.getClientSdkVersion()); assertNotNull(event.getAttributes()); assertTrue(event.getAttributes().equals(analyticsEvent.getAllAttributes())); assertEquals(event.getAttributes().get("key1"), "value1"); assertEquals(event.getAttributes().get("key2"), "value2"); assertNotNull(event.getMetrics()); assertNotNull(event.getSession()); }