Skip to content

Commit ab1bbb4

Browse files
author
Rafael Marinho
committed
fix tests
1 parent 39d2597 commit ab1bbb4

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

‎src/test/java/io/getstream/chat/java/SharedLocationTest.java‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@ static void setupSharedLocations() {
3737
}
3838

3939
/**
40-
* Helper method to create an endAt date that is at least 2 minutes in the future
41-
* to ensure it passes the server validation requirement of being more than 1 minute in the future.
40+
* Helper method to create an endAt date that is at least 2 minutes in the future to ensure it
41+
* passes the server validation requirement of being more than 1 minute in the future.
4242
*/
4343
private Date createFutureEndAt() {
4444
// Add 5 minutes to current time to ensure it's well beyond the 1 minute requirement
4545
// This accounts for any network delays or processing time
4646
return new Date(System.currentTimeMillis() + (5 * 60 * 1000));
4747
}
4848

49-
/**
50-
* Helper method to format a Date to ISO 8601 string format
51-
*/
49+
/** Helper method to format a Date to ISO 8601 string format */
5250
private String formatDateToISO(Date date) {
5351
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
5452
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
@@ -108,8 +106,10 @@ void whenSendingMessageWithSharedLocation_thenCanGetThroughUsersLocations()
108106
// Verify the endAt date is set (allowing for small timing differences)
109107
Assertions.assertNotNull(message.getSharedLocation().getEndAt());
110108
// The endAt should be close to our expected time (within a reasonable range)
111-
long timeDiff = Math.abs(message.getSharedLocation().getEndAt().getTime() - endAtDate.getTime());
112-
Assertions.assertTrue(timeDiff < 60000, "EndAt time should be within 1 minute of expected time");
109+
long timeDiff =
110+
Math.abs(message.getSharedLocation().getEndAt().getTime() - endAtDate.getTime());
111+
Assertions.assertTrue(
112+
timeDiff < 60000, "EndAt time should be within 1 minute of expected time");
113113
}
114114

115115
@DisplayName("Can create live location, update it and verify the update")
@@ -197,7 +197,8 @@ void whenUpdatingLiveLocation_thenCanGetUpdatedLocation() throws StreamException
197197
// Verify the endAt date is set (allowing for small timing differences)
198198
Assertions.assertNotNull(updatedLocation.getEndAt());
199199
long timeDiff = Math.abs(updatedLocation.getEndAt().getTime() - updatedEndAtDate.getTime());
200-
Assertions.assertTrue(timeDiff < 60000, "EndAt time should be within 1 minute of expected time");
200+
Assertions.assertTrue(
201+
timeDiff < 60000, "EndAt time should be within 1 minute of expected time");
201202
}
202203

203204
@DisplayName("Can verify live location in channel")
@@ -251,8 +252,10 @@ void whenQueryingChannel_thenShouldHaveLiveLocation() throws StreamException, Pa
251252

252253
// Verify the endAt date is set (allowing for small timing differences)
253254
Assertions.assertNotNull(message.getSharedLocation().getEndAt());
254-
long timeDiff = Math.abs(message.getSharedLocation().getEndAt().getTime() - endAtDate.getTime());
255-
Assertions.assertTrue(timeDiff < 60000, "EndAt time should be within 1 minute of expected time");
255+
long timeDiff =
256+
Math.abs(message.getSharedLocation().getEndAt().getTime() - endAtDate.getTime());
257+
Assertions.assertTrue(
258+
timeDiff < 60000, "EndAt time should be within 1 minute of expected time");
256259

257260
// Query the channel to verify it has the live location
258261
ChannelGetResponse response =
@@ -279,6 +282,7 @@ void whenQueryingChannel_thenShouldHaveLiveLocation() throws StreamException, Pa
279282
Assertions.assertNotNull(channelLocation.getEndAt());
280283
// Allow for small timing differences in the endAt comparison
281284
long channelTimeDiff = Math.abs(channelLocation.getEndAt().getTime() - endAtDate.getTime());
282-
Assertions.assertTrue(channelTimeDiff < 60000, "EndAt time should be within 1 minute of expected time");
285+
Assertions.assertTrue(
286+
channelTimeDiff < 60000, "EndAt time should be within 1 minute of expected time");
283287
}
284-
}
288+
}

0 commit comments

Comments
 (0)