put code in method, add todo

This commit is contained in:
sk
2023-06-02 01:16:21 +02:00
parent 3985de5b14
commit f373e7df3e
2 changed files with 62 additions and 25 deletions

View File

@@ -27,10 +27,10 @@ public class ThreadFragmentTest {
fakeStatus("younger ancestor", "oldest ancestor")
);
context.descendants = List.of(
fakeStatus("first reply", "main"),
fakeStatus("first reply", "main status"),
fakeStatus("reply to first reply", "first reply"),
fakeStatus("third level reply", "reply to first reply"),
fakeStatus("another reply", "main")
fakeStatus("another reply", "main status")
);
List<Pair<String, Integer>> actual =
ThreadFragment.countAncestryLevels("main status", context);
@@ -55,4 +55,36 @@ public class ThreadFragmentTest {
actual.stream().map(p -> p.second).collect(Collectors.toList())
);
}
@Test
public void sortStatusContext() {
StatusContext context = new StatusContext();
context.ancestors = List.of(
fakeStatus("younger ancestor", "oldest ancestor"),
fakeStatus("oldest ancestor", null)
);
context.descendants = List.of(
fakeStatus("reply to first reply", "first reply"),
fakeStatus("third level reply", "reply to first reply"),
fakeStatus("first reply", "main status"),
fakeStatus("another reply", "main status")
);
ThreadFragment.sortStatusContext(
fakeStatus("main status", "younger ancestor"),
context
);
List<Status> expectedAncestors = List.of(
fakeStatus("oldest ancestor", null),
fakeStatus("younger ancestor", "oldest ancestor")
);
List<Status> expectedDescendants = List.of(
fakeStatus("first reply", "main status"),
fakeStatus("reply to first reply", "first reply"),
fakeStatus("third level reply", "reply to first reply"),
fakeStatus("another reply", "main status")
);
// TODO: ??? i have no idea how this code works. it certainly doesn't return what i'd expect
}
}