ClassCastException for views in integration test

I tried to write a simple integration test following the page UI Integration Tests :: Jmix Documentation

However, I get a ClassCastException when ClaimListView claimListView = UiTestUtils.getCurrentView(); is called.

I checked that I don’t have any duplicate classes. I tried to run the test in IntelliJ and from Gradle (also ran clean before ‘test’) with the same result. I’m using JMIX 2.5.2. The code runs fine when I text the app in the browser.
Do you have any ideas why I get the exception?

Exception:

class com.company.jmix.recoveryplan.view.claim.claim.ClaimListView cannot be cast to class com.company.jmix.recoveryplan.view.claim.claim.ClaimListView (com.company.jmix.recoveryplan.view.claim.claim.ClaimListView is in unnamed module of loader io.jmix.core.impl.JavaClassLoader$FileClassLoader @23b2eda9; com.company.jmix.recoveryplan.view.claim.claim.ClaimListView is in unnamed module of loader 'app')
java.lang.ClassCastException: class com.company.jmix.recoveryplan.view.claim.claim.ClaimListView cannot be cast to class com.company.jmix.recoveryplan.view.claim.claim.ClaimListView (com.company.jmix.recoveryplan.view.claim.claim.ClaimListView is in unnamed module of loader io.jmix.core.impl.JavaClassLoader$FileClassLoader @23b2eda9; com.company.jmix.recoveryplan.view.claim.claim.ClaimListView is in unnamed module of loader 'app')
	at com.company.jmix.recoveryplan.view.claim.claim.ClaimWithRecoveryPlanViewTest.givenClaimListView_whenOpenClaimWithRecoveryPlanWithBalanceZero_thenRecoveryStepEditingDisabled(ClaimWithRecoveryPlanViewTest.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

This is the relevant part of the test:

@UiTest
@SpringBootTest(classes = {RecoveryplanApplication.class, FlowuiTestAssistConfiguration.class})
public class ClaimWithRecoveryPlanViewTest {

    @Autowired
    ViewNavigators viewNavigators;

    @Test
    void givenClaimListView_whenOpenClaimWithRecoveryPlanWithBalanceZero_thenRecoveryStepEditingDisabled() {
        // Navigate to user claim view
        viewNavigators.view(UiTestUtils.getCurrentView(), ClaimListView.class).navigate();

        ClaimListView claimListView = UiTestUtils.getCurrentView();
    }
}

Hello!

Could you check the .jmix/conf directory? I believe it contains the ClaimListView class.

The class is first loaded by the app loader from the build folder. Then, following the logic in JmixClassLoader, it loads this class again from the conf folder using the “Jmix” loader.

There’s only the following directories in the folder .jmix

.jmix$ ls
screen-designer temp

I only get one class:

$ find . -name "*ClaimListView*"
./build/classes/java/main/com/company/jmix/recoveryplan/view/claim/claim/ClaimListView.class
./src/main/java/com/company/jmix/recoveryplan/view/claim/claim/ClaimListView.java