Skip to content

Commit e58ccaf

Browse files
committed
refactor: auditEntryExpectation comments and removed getters
1 parent ff34a16 commit e58ccaf

1 file changed

Lines changed: 4 additions & 65 deletions

File tree

core/flamingock-test-support/src/main/java/io/flamingock/support/domain/AuditEntryExpectation.java

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ public static AuditEntryExpectation ROLLBACK_FAILED(String expectedChangeId) {
166166
return new AuditEntryExpectation(expectedChangeId, ROLLBACK_FAILED);
167167
}
168168

169-
// ==================== Class-Based Factory Methods ====================
170-
171169
/**
172170
* Creates an expectation for a successfully applied change by extracting
173171
* metadata from the change class annotations.
@@ -300,8 +298,6 @@ private static String findMethodName(Class<?> changeClass, AuditEntry.Status sta
300298
annotationClass.getSimpleName()));
301299
}
302300

303-
// ==================== Identity Fields ====================
304-
305301
/**
306302
* Sets the expected execution ID for verification.
307303
*
@@ -328,8 +324,6 @@ public AuditEntryExpectation withStageId(String stageId) {
328324
return this;
329325
}
330326

331-
// ==================== Metadata Fields ====================
332-
333327
/**
334328
* Sets the expected author of the change.
335329
*
@@ -372,8 +366,6 @@ public AuditEntryExpectation withTimestampBetween(LocalDateTime after, LocalDate
372366
return this;
373367
}
374368

375-
// ==================== Execution Fields ====================
376-
377369
/**
378370
* Sets the expected fully-qualified class name.
379371
*
@@ -413,8 +405,6 @@ public AuditEntryExpectation withMetadata(Object metadata) {
413405
return this;
414406
}
415407

416-
// ==================== Performance Fields ====================
417-
418408
/**
419409
* Sets the expected execution duration in milliseconds.
420410
*
@@ -441,8 +431,6 @@ public AuditEntryExpectation withExecutionHostname(String hostname) {
441431
return this;
442432
}
443433

444-
// ==================== Error Fields ====================
445-
446434
/**
447435
* Sets the expected error trace for failed changes.
448436
*
@@ -457,8 +445,6 @@ public AuditEntryExpectation withErrorTrace(String errorTrace) {
457445
return this;
458446
}
459447

460-
// ==================== Target System Fields ====================
461-
462448
/**
463449
* Sets the expected target system identifier.
464450
*
@@ -470,8 +456,6 @@ public AuditEntryExpectation withTargetSystemId(String targetSystemId) {
470456
return this;
471457
}
472458

473-
// ==================== Comparison Logic ====================
474-
475459
/**
476460
* Compares this expectation against an actual audit entry.
477461
*
@@ -547,13 +531,13 @@ public List<FieldMismatchError> compareWith(AuditEntry actual) {
547531
errors.add(new FieldMismatchError("targetSystemId", expectedTargetSystemId, actual.getTargetSystemId()));
548532
}
549533

550-
// Timestamp verification
551-
compareTimestamp(actual, errors);
534+
errors.addAll(compareTimestamp(actual));
552535

553536
return errors;
554537
}
555538

556-
private void compareTimestamp(AuditEntry actual, List<FieldMismatchError> errors) {
539+
private List<FieldMismatchError> compareTimestamp(AuditEntry actual) {
540+
List<FieldMismatchError> errors = new ArrayList<>();
557541
if (expectedCreatedAt != null) {
558542
// Exact match mode
559543
if (!expectedCreatedAt.equals(actual.getCreatedAt())) {
@@ -583,6 +567,7 @@ private void compareTimestamp(AuditEntry actual, List<FieldMismatchError> errors
583567
}
584568
}
585569
}
570+
return errors;
586571
}
587572

588573
private String formatTimestampRange() {
@@ -595,50 +580,4 @@ private String formatTimestampRange() {
595580
}
596581
}
597582

598-
// ==================== Getters (for verification logic) ====================
599-
600-
/** Returns the expected execution ID. */
601-
public String getExpectedExecutionId() { return expectedExecutionId; }
602-
603-
/** Returns the expected stage ID. */
604-
public String getExpectedStageId() { return expectedStageId; }
605-
606-
/** Returns the expected change ID. */
607-
public String getExpectedChangeId() { return expectedChangeId; }
608-
609-
/** Returns the expected author. */
610-
public String getExpectedAuthor() { return expectedAuthor; }
611-
612-
/** Returns the expected creation timestamp. */
613-
public LocalDateTime getExpectedCreatedAt() { return expectedCreatedAt; }
614-
615-
/** Returns the expected audit entry status. */
616-
public AuditEntry.Status getExpectedState() { return expectedState; }
617-
618-
/** Returns the expected class name. */
619-
public String getExpectedClassName() { return expectedClassName; }
620-
621-
/** Returns the expected method name. */
622-
public String getExpectedMethodName() { return expectedMethodName; }
623-
624-
/** Returns the expected metadata. */
625-
public Object getExpectedMetadata() { return expectedMetadata; }
626-
627-
/** Returns the expected execution duration in milliseconds. */
628-
public Long getExpectedExecutionMillis() { return expectedExecutionMillis; }
629-
630-
/** Returns the expected execution hostname. */
631-
public String getExpectedExecutionHostname() { return expectedExecutionHostname; }
632-
633-
/** Returns the expected error trace. */
634-
public String getExpectedErrorTrace() { return expectedErrorTrace; }
635-
636-
/** Returns the expected target system ID. */
637-
public String getExpectedTargetSystemId() { return expectedTargetSystemId; }
638-
639-
/** Returns the lower bound for timestamp range verification. */
640-
public LocalDateTime getTimestampAfter() { return timestampAfter; }
641-
642-
/** Returns the upper bound for timestamp range verification. */
643-
public LocalDateTime getTimestampBefore() { return timestampBefore; }
644583
}

0 commit comments

Comments
 (0)