Skip to main content

Jupiter

Simple Story

This is the piece that puts the checklist into the hands of the teacher who runs the examination.

It is what makes a question public or hidden, what refuses to ask a hidden question before its deadline, and what puts a desk under supervision when the question asks for it.

What it does​

This is the primary test-framework binding. It is the package that defines the annotations an exercise author writes, and it hooks into the JUnit Jupiter lifecycle so that Ares gets a say before, around and after every test.

What is in it​

ClassPurpose
@Public / @HiddenMarks whether a test's result is shown immediately or held until the deadline
@PublicTest / @HiddenTestThe same, combined with JUnit's own @Test
JupiterAresTestInternal meta-annotation that registers all four extensions at once
JupiterSecurityExtensionReads the @Policy configuration and applies the sandbox around each test and around the constructor and setup and teardown methods, resetting it afterwards. A phase that runs before any method policy is known needs a class @Policy
JupiterTestGuardApplies the pre- and post-test guards, including the deadline check
JupiterIOExtensionRedirects System.in, System.out and System.err
JupiterStrictTimeoutExtensionEnforces @StrictTimeout
JupiterLocaleExtensionApplies @UseLocale around a class
JupiterContextAdapts JUnit's ExtensionContext to the Ares TestContext
UnifiedInvocationInterceptorCollapses JUnit's many InvocationInterceptor callbacks into one generic method

An Ares test annotation is what registers these extensions: @PublicTest and @HiddenTest, or @Public and @Hidden combined with JUnit's @Test, all carry JupiterAresTest. @Policy only selects and configures the policy, so a plain JUnit @Test that carries a @Policy but no Ares test annotation runs unsupervised.

Why it is shaped this way​

JupiterContext is an adapter. It exists so that the logic behind the guards and the sandbox is written against the framework-agnostic TestContext rather than against JUnit, which keeps that logic independent of the test framework.

The deadline check runs in the guard before the test body executes. A hidden test that is not yet due never runs at all, rather than running and having its result suppressed, because a test that runs can leave traces in a file or a static field.

Further reading​