Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ public class BatchPayloadWriterTest {
.endObject()
.close();

// todo: inject a fake clock. for now we'll compare a lower precision.
String date = toISO8601Date(new Date());
String expectedDate = date.substring(0, date.length() - 8);

assertThat(byteArrayOutputStream.toString()) //
.isEqualTo("{\"batch\":[qaz],\"sentAt\":\"" + toISO8601Date(new Date()) + "\"}")
.overridingErrorMessage("its ok if this failed close to midnight!");
.contains("{\"batch\":[qaz],\"sentAt\":\"" + expectedDate);
}

@Test public void batchPayloadWriterFailsForNoItem() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public final class Utils {
private static final ThreadLocal<DateFormat> ISO_8601_DATE_FORMAT =
new ThreadLocal<DateFormat>() {
@Override protected DateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US);
}
};

Expand Down