Skip to content

Commit 28b6eef

Browse files
fix(s1): enforce single-assert pattern in persistence ITs (STA-108)
Replace scattered metadata assertThat calls with single usingRecursiveComparison().isEqualTo(expected) for JSONB tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0e70215 commit 28b6eef

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • payment-orchestrator/payment-orchestrator/src/integration-test/java/com/stablecoin/payments/orchestrator/infrastructure/persistence

payment-orchestrator/payment-orchestrator/src/integration-test/java/com/stablecoin/payments/orchestrator/infrastructure/persistence/PaymentPersistenceAdapterIT.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ void shouldPersistAndRetrieveJsonbMetadata() {
158158
);
159159
adapter.save(withMetadata);
160160

161-
var found = adapter.findById(withMetadata.paymentId());
162-
assertThat(found).isPresent();
163-
assertThat(found.get().metadata()).containsEntry("source", "api");
164-
assertThat(found.get().metadata()).containsEntry("priority", "high");
165-
assertThat(found.get().metadata()).containsEntry("merchantRef", "M-12345");
161+
assertThat(adapter.findById(withMetadata.paymentId())).isPresent().get()
162+
.usingRecursiveComparison()
163+
.withComparatorForType(BigDecimal::compareTo, BigDecimal.class)
164+
.ignoringFieldsOfTypes(Instant.class)
165+
.isEqualTo(withMetadata);
166166
}
167167

168168
@Test
@@ -171,9 +171,11 @@ void shouldPersistEmptyMetadataAsEmptyJsonObject() {
171171
var payment = anInitiatedPayment();
172172
var saved = adapter.save(payment);
173173

174-
var found = adapter.findById(saved.paymentId());
175-
assertThat(found).isPresent();
176-
assertThat(found.get().metadata()).isEmpty();
174+
assertThat(adapter.findById(saved.paymentId())).isPresent().get()
175+
.usingRecursiveComparison()
176+
.withComparatorForType(BigDecimal::compareTo, BigDecimal.class)
177+
.ignoringFieldsOfTypes(Instant.class)
178+
.isEqualTo(saved);
177179
}
178180

179181
// ── Optimistic locking ──────────────────────────────────────────────

0 commit comments

Comments
 (0)