Skip to content

JPA assertions check order even if not told #640

@dwaam

Description

@dwaam

Hello,

We currently have an issue with an assertion in JPA:

Then within 10000ms the dynamic_leadtime table contains exactly:
      | id | legId | value | unit | validityStartDate                 | validityEndDate                 | confidenceScore | createdBy.user | createdBy.system | createdAt | updatedBy.user | updatedBy.system | updatedAt |
      | 61 | 51    | 38    | DAY  | {{[@today as a localdate]}}       | 2998-12-31                      | D               | TRANSPORT_REF  | CONSUMER         | ?notNull  | TRANSPORT_REF  | CONSUMER         | ?notNull  |
      | 60 | 51    | 11    | DAY  | {{[@20 days ago as a localdate]}} | {{[@yesterday as a localdate]}} | A               | TOTO           | TITI             | ?notNull  | TRANSPORT_REF  | CONSUMER         | ?notNull  |
- createdBy:
    user: "TRANSPORT_REF"
    system: "CONSUMER"
  createdAt: "2025-08-26T15:18:02.751709Z"
  updatedBy:
    user: "TRANSPORT_REF"
    system: "CONSUMER"
  updatedAt: "2025-08-26T15:18:02.751709Z"
  id: 61
  legId: 51
  value: 38
  unit: "DAY"
  validityStartDate: "2025-08-26"
  validityEndDate: "2998-12-31"
  confidenceScore: "D"
- createdBy:
    user: "TOTO"
    system: "TITI"
  createdAt: "2025-08-26T15:18:00.606Z"
  updatedBy:
    user: "TRANSPORT_REF"
    system: "CONSUMER"
  updatedAt: "2025-08-26T15:18:02.786715Z"
  id: 60
  legId: 51
  value: 11
  unit: "DAY"
  validityStartDate: "2025-08-06"
  validityEndDate: "2025-08-25"
  confidenceScore: "A"

We get the error:

is not equal to expected:
	[0].validityStartDate' -> expected:<2025-08-[0]6> but was:<2025-08-[2]6>
	[0].createdBy.system' -> expected:<[TITI]> but was:<[CONSUMER]>
	[0].createdBy.user' -> expected:<T[OTO]> but was:<T[RANSPORT_REF]>
	[0].validityEndDate' -> expected:<2[025-08-25]> but was:<2[998-12-31]>
	[0].confidenceScore' -> expected:<[A]> but was:<[D]>
	[0].id' -> expected:<6[0]> but was:<6[1]>
	[0].value' -> expected:<[11]> but was:<[38]>
	[1].validityStartDate' -> expected:<2025-08-[2]6> but was:<2025-08-[0]6>
	[1].createdBy.system' -> expected:<[CONSUMER]> but was:<[TITI]>
	[1].createdBy.user' -> expected:<T[RANSPORT_REF]> but was:<T[OTO]>
	[1].validityEndDate' -> expected:<2[998-12-31]> but was:<2[025-08-25]>
	[1].confidenceScore' -> expected:<[D]> but was:<[A]>
	[1].id' -> expected:<6[1]> but was:<6[0]>
	[1].value' -> expected:<[38]> but was:<[11]>

When we invert the two lines in the assertion, it works.
Should the assertion succeed unless we add in order ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions