Skip to main content

Jupiter

Simple Story

This part tells the teacher how to run each question. Before each question, it has the teacher pick up the rule sheet, and afterwards put it away. It holds the stopwatch and listens to pupils who answer out loud.

It decides whether the teacher says straight away if an answer was right, or only after the whole examination. Before the examination is over, the teacher does not even ask a question whose answer they keep back, so it leaves no trace.

The trap: the rule sheet counts only for a question marked one of those two ways. A question with neither mark runs with nobody clearing the desks or watching, even with a rule sheet attached.

Who is who

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​