@@ -111,6 +111,7 @@ public class AuditEntryExpectation {
111111 private String expectedTargetSystemId ;
112112 private RecoveryStrategy expectedRecoveryStrategy ;
113113 private String expectedOrder ;
114+ private Boolean expectedTransactional ;
114115
115116 // Time range for flexible timestamp verification
116117 private LocalDateTime timestampAfter ;
@@ -293,6 +294,8 @@ private static AuditEntryExpectation fromChangeClass(Class<?> changeClass, Audit
293294
294295 expectation .expectedOrder = extractOrderFromClassName (changeClass .getSimpleName ());
295296
297+ expectation .expectedTransactional = changeAnnotation .transactional ();
298+
296299 return expectation ;
297300 }
298301
@@ -508,6 +511,19 @@ public AuditEntryExpectation withOrder(String order) {
508511 return this ;
509512 }
510513
514+ /**
515+ * Sets the expected transactional flag for verification.
516+ *
517+ * <p>Indicates whether the change should run within a transaction.</p>
518+ *
519+ * @param transactional the expected transactional flag
520+ * @return this builder for method chaining
521+ */
522+ public AuditEntryExpectation withTransactional (boolean transactional ) {
523+ this .expectedTransactional = transactional ;
524+ return this ;
525+ }
526+
511527 /**
512528 * Compares this expectation against an actual audit entry.
513529 *
@@ -593,6 +609,12 @@ public List<FieldMismatchError> compareWith(AuditEntry actual) {
593609 errors .add (new FieldMismatchError ("order" , expectedOrder , actual .getOrder ()));
594610 }
595611
612+ if (expectedTransactional != null && !expectedTransactional .equals (actual .getTransactionFlag ())) {
613+ errors .add (new FieldMismatchError ("transactional" ,
614+ String .valueOf (expectedTransactional ),
615+ String .valueOf (actual .getTransactionFlag ())));
616+ }
617+
596618 errors .addAll (compareTimestamp (actual ));
597619
598620 return errors ;
0 commit comments