Skip to content

SoftAssertions changes error #107

Closed
@soezen

Description

@soezen
softAssertions.assertThat(changes).ofCreationOnTable(tableName).hasNumberOfChanges(1);

results in error


org.assertj.db.exception.AssertJDBException: There is an exception 'org.assertj.db.api.ChangesAssert$ByteBuddy$TtRdXl7M'
	 in the instantiation of the element org.assertj.db.api.ChangesAssert
	 on class org.assertj.db.type.Changes with class org.assertj.db.api.ChangesAssert$ByteBuddy$TtRdXl7M.
 It is normally impossible.
 That means there is a big mistake in the development of AssertJDB.
 Please write an issue for that if you meet this problem.

	at org.assertj.db.navigation.PositionWithChanges.getChangesInstance(PositionWithChanges.java:135)
	at org.assertj.db.api.ChangesAssert.ofCreation(ChangesAssert.java:96)
	at org.assertj.db.api.ChangesAssert$ByteBuddy$TtRdXl7M.ofCreation$accessor$KthGkVzp(Unknown Source)
	at org.assertj.db.api.ChangesAssert$ByteBuddy$TtRdXl7M$AssertJDb$SoftProxies$tYMTquiR.call(Unknown Source)
	at org.assertj.db.api.ProxifyPositionResult.intercept(ProxifyPositionResult.java:43)
	at org.assertj.db.api.ChangesAssert$ByteBuddy$TtRdXl7M.ofCreation(Unknown Source)
	at org.assertj.db.api.ChangesAssert$ByteBuddy$TtRdXl7M.ofCreation(Unknown Source)
	at org.assertj.db.api.AbstractAssertWithOriginWithChanges.ofCreation(AbstractAssertWithOriginWithChanges.java:57)
	at org.assertj.db.api.ChangeAssert$ByteBuddy$uKlLzKqG.ofCreation$accessor$TFsp0MZt(Unknown Source)
	at org.assertj.db.api.ChangeAssert$ByteBuddy$uKlLzKqG$AssertJDb$SoftProxies$ih8LKRw6.call(Unknown Source)
	at org.assertj.db.api.ProxifyPositionResult.intercept(ProxifyPositionResult.java:43)
	at org.assertj.db.api.ChangeAssert$ByteBuddy$uKlLzKqG.ofCreation(Unknown Source)

In debug it seems that the error occurs on line 128
of PositionWithChanges, there the class name has a replace

Class clazz = Class.forName(myself.getClass().getName().replaceAll("\\$\\$.*", ""));

I think the regex should be replaced with \\$.*\\$.* or \\$.*
As you can see in the error message the actual class name has text in between which is why the current regex is not working

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