Skip to main content

juneau-bct

Maven
<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-bct</artifactId>
<version>${juneau.version}</version>
</dependency>
Jarjuneau-bct-10.0.0.jar
OSGiorg.apache.juneau.test_10.0.0.jar
LinksMaven Central · Javadocs · Source

Contents/Features​

The juneau-bct module is a lightweight, self-contained toolkit for writing readable, expressive unit tests. It depends only on JUnit 5 and the core Juneau commons — no heavyweight frameworks — and is used throughout Juneau's own test suite as well as by the built-in assertion methods on the REST client and server APIs.

It is organized into three complementary areas:

  • Assertions Overview — the fluent-style assertions API in the org.apache.juneau.bct.assertions package. The Assertions class provides typed, chainable assertion objects for strings, numbers, beans, collections, dates, throwables, and more. It powers the inline assertions used by the REST APIs and works equally well standalone in unit tests.

  • Bean-Centric Testing — the BCT framework in the org.apache.juneau.bct package. The BctAssertions static methods (assertBean, assertBeans, assertList, assertMapped, …) collapse verbose, multi-line property extraction into single, intention-revealing assertions with a flexible nested property syntax. Behavior is customizable via Customization (stringifiers, listifiers, swappers) and Property Extractors.

  • JUnit Extensions — a small JUnit 5 extension in the org.apache.juneau.bct.junit package for test-time bean injection — swapping production beans with test doubles inside a Juneau BeanStore for the duration of a test.

In This Section​