quarkusio/quarkus · error · AssertionError
Not equal; expected: " + Arrays.toString(expected) + ", actu
Error message
Not equal; expected: " + Arrays.toString(expected) + ", actual: " + Arrays.toString(actual)
What it means
This AssertionError is thrown by the Hibernate 5.6 compatibility integration test when two int[] arrays (expected vs actual query results) differ in content or order. It is a test-side assertion, not a library error, meaning the migration behavior produced different data than the baseline.
Source
Thrown at integration-tests/hibernate-orm-compatibility-5.6/database-generator/src/main/java/io/quarkus/it/hibernate/compatibility/Main.java:97
checkEqual(createdEntity.zonedDateTime.withZoneSameInstant(ZoneId.systemDefault()), loadedEntity.zonedDateTime);
checkEqual(createdEntity.intArray, loadedEntity.intArray);
checkEqual(createdEntity.stringList, loadedEntity.stringList);
checkEqual(createdEntity.myEnum, loadedEntity.myEnum);
});
System.out.println("Done.");
return 0;
}
private <T> void checkEqual(T expected, T actual) {
if (!Objects.equals(expected, actual)) {
throw new AssertionError("Not equal; expected: " + expected + ", actual: " + actual);
}
}
private void checkEqual(int[] expected, int[] actual) {
if (!Arrays.equals(expected, actual)) {
throw new AssertionError("Not equal; expected: " + Arrays.toString(expected)
+ ", actual: " + Arrays.toString(actual));
}
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Inspect the expected vs actual array contents in the message to identify which rows differ
- Verify the database schema matches what the generator produced for 5.6
- Check for ORM version-specific query ordering; add explicit ORDER BY if order matters
- Re-seed test data and re-run the test
Example fix
// before
throw new AssertionError("Not equal; expected: " + expected + ", actual: " + actual);
// after
throw new AssertionError("Not equal; expected: " + Arrays.toString(expected) + ", actual: " + Arrays.toString(actual)); Defensive patterns
Strategy: validation
Validate before calling
if (!Arrays.equals(expected, actual)) { System.err.println("expected=" + Arrays.toString(expected) + " actual=" + Arrays.toString(actual)); } Try / catch
try { run(); } catch (AssertionError e) { log.error("Data mismatch after migration: {}", e.getMessage()); throw e; } Prevention
- Add ORDER BY to queries whose order you assert on
- Seed deterministic test data before comparing
- Compare as sets when order is not significant
When it happens
Trigger: Running Main.run() against the compatibility database when entity rows migrated from Hibernate ORM 5.6 do not match the expected id ordering/data returned by the same query under the newer ORM version.
Common situations: Schema or dialect differences between Hibernate 5.6 and the newer version, missing data migration, differing default ordering of results, or test data seeded incorrectly.
Related errors
- Incorrect citizen: " + country.getName() + ", expected: " +
- Incorrect citizen: " + citizen.getLastname() + ", expected:
- Incorrect citizen: " + citizen.getLastname() + ", expected:
- Incorrect family size: " + pokemons.size() + ", expected: "
- Incorrect description: " + i1.getDescription() + ", expected
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c79f043a6c12141a.
Report an issue: GitHub.