Skip to content

Commit

Permalink
test: basic lazy load operation
Browse files Browse the repository at this point in the history
  • Loading branch information
ParanoidUser committed Nov 12, 2023
1 parent 754a48b commit f79b816
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
package dev.noid.codewars.client;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.List;
import org.junit.jupiter.api.Test;

class LazyListTest {

@Test
void load_first_two_pages() {
List<String>[] pages = new List[] {
List.of("a", "b", "c", "d", "e"),
List.of("f", "g", "h", "i", "j"),
List.of("k", "l", "m", "n", "o"),
List.of("p", "q", "r", "s", "t")
};

var lazy = new LazyList<>(index -> pages[index], List.of(), 5, 10);
assertEquals(List.of("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"), lazy);
assertEquals(10, lazy.size());
}
}

0 comments on commit f79b816

Please sign in to comment.