@Test

The JUnit annotation that marks a method as a test to discover and run.

In more detail

Test methods need no particular name, so name them after the behaviour they check, such as greets_a_name. Each runs on a fresh instance of the test class, which keeps tests independent.

Example

@Test void greets_a_name() { assertEquals("Hello Ada", Greeting.text("Ada")); }

Related terms

Taught in

References