Skip to content
Closed
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 @@ -22,6 +22,7 @@
* An {@link UpdateEvent} that includes progress information.
*
* @author Phillip Webb
* @author Wolfgang Kronberg
* @since 2.3.0
*/
public abstract class ProgressUpdateEvent extends UpdateEvent {
Expand Down Expand Up @@ -67,12 +68,12 @@ public String getProgress() {
*/
public static class ProgressDetail {

private final Integer current;
private final Long current;

private final Integer total;
private final Long total;

@JsonCreator
public ProgressDetail(Integer current, Integer total) {
public ProgressDetail(Long current, Long total) {
this.current = current;
this.total = total;
}
Expand All @@ -81,15 +82,15 @@ public ProgressDetail(Integer current, Integer total) {
* Return the current progress value.
* @return the current progress
*/
public int getCurrent() {
public long getCurrent() {
return this.current;
}

/**
* Return the total progress possible value.
* @return the total progress possible
*/
public int getTotal() {
public long getTotal() {
return this.total;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @param <E> The event type
* @author Phillip Webb
* @author Scott Frederick
* @author Wolfgang Kronberg
*/
abstract class ProgressUpdateEventTests<E extends ProgressUpdateEvent> {

Expand All @@ -44,6 +45,13 @@ void getProgressDetailsReturnsProgressDetails() {
assertThat(event.getProgressDetail().getTotal()).isEqualTo(2);
}

@Test
void getProgressDetailsReturnsProgressDetailsForLongNumbers() {
ProgressUpdateEvent event = createEvent("status", new ProgressDetail(4000000000L, 8000000000L), "progress");
assertThat(event.getProgressDetail().getCurrent()).isEqualTo(4000000000L);
assertThat(event.getProgressDetail().getTotal()).isEqualTo(8000000000L);
}

@Test
void getProgressReturnsProgress() {
ProgressUpdateEvent event = createEvent();
Expand All @@ -52,24 +60,24 @@ void getProgressReturnsProgress() {

@Test
void progressDetailIsEmptyWhenCurrentIsNullReturnsTrue() {
ProgressDetail detail = new ProgressDetail(null, 2);
ProgressDetail detail = new ProgressDetail(null, 2L);
assertThat(ProgressDetail.isEmpty(detail)).isTrue();
}

@Test
void progressDetailIsEmptyWhenTotalIsNullReturnsTrue() {
ProgressDetail detail = new ProgressDetail(1, null);
ProgressDetail detail = new ProgressDetail(1L, null);
assertThat(ProgressDetail.isEmpty(detail)).isTrue();
}

@Test
void progressDetailIsEmptyWhenTotalAndCurrentAreNotNullReturnsFalse() {
ProgressDetail detail = new ProgressDetail(1, 2);
ProgressDetail detail = new ProgressDetail(1L, 2L);
assertThat(ProgressDetail.isEmpty(detail)).isFalse();
}

protected E createEvent() {
return createEvent("status", new ProgressDetail(1, 2), "progress");
return createEvent("status", new ProgressDetail(1L, 2L), "progress");
}

protected abstract E createEvent(String status, ProgressDetail progressDetail, String progress);
Expand Down