@Test

Used to mark a function as a test in JUnit.

What does @Test do?

In JUnit, @Test marks a method as a test.

@Test
void deposit_should_increaseBalance() {
    var account = new Account();
    account.deposit(50);
    assertEquals(50, account.getBalance());
}

Level: Apprentice · More Java terms at this level

Updated