-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
754a48b
commit f79b816
Showing
1 changed file
with
17 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 17 additions & 1 deletion
18
codewars-sdk-client/src/test/java/dev/noid/codewars/client/LazyListTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |