agentsclimarketplace

Fluent assert

Skill Ahoo-Wang/skills/plugins/ahoo-fluent-assert-skills/skills/fluent-assert

A central aggregation repository for Agent Skills from Ahoo-Wang's open source projects.

Install
npx -y skills add Ahoo-Wang/skills --skill fluent-assert

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when writing or refactoring Kotlin tests that need assertions, including JUnit tests, Wow/SagaSpec tests, JDK types, nullable values, collections, maps, time values, futures, predicates, custom data classes, or exception assertions with assertThrownBy.

SKILL.md

2.8 KB, as published. Nobody here has run it

FluentAssert

Use FluentAssert for Kotlin assertions in this repository and in downstream Kotlin test examples. Prefer the Kotlin extension style over direct AssertJ calls.

Core Rule

import me.ahoo.test.asserts.assert

actual.assert().isEqualTo(expected)

Avoid assertThat(actual) in ordinary test code. FluentAssert keeps nullable receivers natural:

val name: String? = null
name.assert().isNull()

Common Patterns

NeedPattern
Primitive/string/objectvalue.assert().isEqualTo(expected)
Collection/list/mapitems.assert().hasSize(2).contains("a")
Nullable valuevalue.assert().isNull() or value.assert().isNotNull()
Exception lambdaassertThrownBy<IllegalArgumentException> { call() }.hasMessage("bad")
Existing exceptionthrowable.assert().hasMessageContaining("bad")
Time month checksdate.assert().hasMonth(Month.APRIL)
Future success/failurefuture.assert().isCompletedWithValue(value) / .isCompletedExceptionally()
Recursive comparisonactual.assert().usingRecursiveComparison().isEqualTo(expected)

For exception lambdas, also import:

import me.ahoo.test.asserts.assertThrownBy

For month assertions, import java.time.Month; AssertJ expects Month, not an integer.

Wow/Saga Tests

Use FluentAssert inside expectation blocks too:

expectCommandBody<UpdateDemo> {
    data.assert().isNotNull().isEqualTo("updated")
}

AssertProvider

For types implementing AssertJ's AssertProvider<A>, .assert() returns the provider's custom assertion type:

provider.assert().isPositive()

Only use direct assertThat when implementing the provider's assertThat() method or when a project explicitly requires raw AssertJ.

Avoid

  • Do not chain .assert() after assertThrownBy; it already returns ThrowableAssert<T>.
  • Do not assert contradictory states on one value, such as Optional.of("x").assert().isPresent().isEmpty().
  • Do not use unavailable AssertJ shortcuts like OffsetDateTimeAssert.hasOffset(...).
  • Do not use numeric hasMonth(4) for LocalDate or YearMonth; use hasMonth(Month.APRIL).
  • Do not switch to assertThat(value).usingRecursiveComparison(); keep chaining from value.assert().

References

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.