quarkusio/quarkus · error · AssertionError

Not equal; expected: " + expected + ", actual: " + actual

Error message

Not equal; expected: " + expected + ", actual: " + actual

What it means

An AssertionError thrown by the checkEqual helper in the Hibernate ORM 5.6 compatibility integration test when an expected value (read from a database generated by Hibernate ORM 5.6) does not equal the actual value (read via Quarkus' newer Hibernate ORM). It signals a data or schema-mapping incompatibility between the ORM versions for the compared column/table.

Source

Thrown at integration-tests/hibernate-orm-compatibility-5.6/database-generator/src/main/java/io/quarkus/it/hibernate/compatibility/Main.java:91

                checkEqual(createdEntity.uuid, loadedEntity.uuid);
                checkEqual(createdEntity.instant, loadedEntity.instant);
                checkEqual(createdEntity.offsetTime.toLocalTime().atOffset(ZoneId.systemDefault().getRules().getOffset(Instant.now())),
                        loadedEntity.offsetTime);
                checkEqual(createdEntity.offsetDateTime.atZoneSameInstant(ZoneId.systemDefault()).toOffsetDateTime(),
                        loadedEntity.offsetDateTime);
                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

  1. Compare the failing expected vs actual values in the AssertionError message to identify the mismatched column/entity
  2. Regenerate the 5.6 database with the database-generator after any schema or entity changes
  3. Check for ORM 5.6-to-6 migration mapping differences (types, naming strategy, ID generation) affecting the compared data
  4. Update the expected values or add an explicit mapping/compatibility workaround if the difference is an intentional ORM change

Example fix

// before
private <T> void checkEqual(T expected, T actual) {
    if (!Objects.equals(expected, actual)) throw new AssertionError(...);
}
// after
private <T> void checkEqual(T expected, T actual) {
    if (!Objects.equals(expected, actual))
        throw new AssertionError("Not equal; expected: " + expected + ", actual: " + actual);
}
// and regenerate the 5.6 database so expected matches the current schema
Defensive patterns

Strategy: validation

Validate before calling

if (!Arrays.equals(expected, actual)) {
    throw new AssertionError("Version mismatch: expected=" + Arrays.toString(expected) + " actual=" + Arrays.toString(actual));
}
// run before comparing: regenerate 5.6 database and confirm schema matches current mappings

Try / catch

try {
    run();
} catch (AssertionError e) {
    if (e.getMessage().startsWith("Not equal;")) {
        // regenerate the 5.6 database, then re-run comparison
    }
}

Prevention

When it happens

Trigger: checkEqual(expected, actual) is invoked by the run() workflow comparing int arrays or objects read from the 5.6-generated database against values read/written by the current ORM; Objects.equals or Arrays.equals returns false and the AssertionError is thrown.

Common situations: Hibernate ORM 6+ changed default column types, naming, or value mapping versus 5.6 so data round-trips differently; the 5.6 generator produced data with types the new ORM reads differently (e.g. temporal/serializable types); the generator was not re-run after schema changes.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/14931536b7b409d7. Report an issue: GitHub.