From 331c33b975da85f5b86418e535fc521276eedbed Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Mon, 22 Jan 2024 14:37:30 -0800 Subject: [PATCH] Changing assumptions - The SyncedPlan no longer runs immediately if executed on the main thread. - Update tests/names to reflect this change. --- .../com/jozufozu/flywheel/lib/task/PlanExecutionTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java b/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java index 884bbe974..5ed4ea106 100644 --- a/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java +++ b/src/test/java/com/jozufozu/flywheel/lib/task/PlanExecutionTest.java @@ -189,17 +189,21 @@ class PlanExecutionTest { } @Test - void mainThreadPlanRunsImmediately() { + void syncedPlanDefersOnMainThread() { var done = new AtomicBoolean(false); var plan = SyncedPlan.of(() -> done.set(true)); plan.execute(EXECUTOR, Unit.INSTANCE); + Assertions.assertFalse(done.get()); + + EXECUTOR.syncPoint(); + Assertions.assertTrue(done.get()); } @Test - void mainThreadPlanIsNotCalledOffThread() { + void syncedPlanDefersOffThread() { var done = new AtomicBoolean(false); var plan = SyncedPlan.of(() -> {