static import

An import that brings a class's static methods into scope so they can be called without the class name, such as assertThat.

In more detail

Test code uses static imports so assertions read fluently. Use them sparingly in production code, where the class name often helps the reader.

Example

import static org.assertj.core.api.Assertions.assertThat;

Related terms

Taught in

References