juneau-bct
| Maven | |
|---|---|
| Jar | juneau-bct-10.0.0.jar |
| OSGi | org.apache.juneau.test_10.0.0.jar |
| Links | Maven 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
BeanStorefor the duration of a test.
In This Section
📄️ 2.6.1. Assertions Overview
The org.apache.juneau.bct.assertions package in Juneau (provided by the juneau-bct module) is a powerful API for performing
🗃️ 2.6.2. Bean-Centric Testing
3 items
📄️ 2.6.3. JUnit Extensions
The juneau-bct module bundles a small JUnit 5 extension for test-time bean injection — swapping production beans with test doubles inside a Juneau BeanStore for the duration of a JUnit 5 test, without modifying production code and without proxying. It is the Juneau-flavored answer to Spring's @TestConfiguration / @MockBean.