I guess this should be `ACL.SYSTEM`, right? How do you know it actually differs from the `SecurityContext` in effect in tasks run in the plain `service`? Your test does not assert that.

Nor does it check that the `SecurityContext` in effect when `execute` and the like is used, as opposed to the context in effect when `wrapExecutorWithSecurityContext` is called, since you are doing both from the same thread.

Typically the factory would be called in an initialization thread with `ACL.SYSTEM`, the standard thread pool has no context at all, and calls like `execute` would be made from HTTP handler threads with user-specific permissions. So a convincing test would set up an environment with all three kinds of contexts, verifying that their initial contexts are all different, and only then check that the wrapper forces the thread pool tasks to pick up the context from the handler thread. (It may not be necessary to actual create a new “handler” thread distinct from the test main thread, but you should at least call `setContext` with a new context after creating the wrapper service and before submitting tasks to it.)