But ... I need change the fake PersistentStateComponent frequently to test with different settings, is that possible to do that? As I see, in your example are all use pre-defined class ...
The mock PersistentStateComponent can have setters to update necessary settings.
Probably, your non-mock PersistentStateComponent has setters too. Can't you just set necessary settings before each run (and reset back to defaults in tearDown)?
You can manually register mock component in tests by casting `Application.getPicoContainer` or `Project.getPicoContainer` to `MutablePicoContainer`.
https://github.com/JetBrains/intellij-community/blob/533d8ce5d83deb44e0e0f9494e175456d0161deb/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/roots/VcsIntegrationEnablerTest.java#L41
Or you can use custom plugin.xml in tests and use "overrides" attribute.
https://github.com/JetBrains/intellij-community/blob/533d8ce5d83deb44e0e0f9494e175456d0161deb/plugins/git4idea/tests/META-INF/plugin.xml#L12
But ... I need change the fake PersistentStateComponent frequently to test with different settings, is that possible to do that? As I see, in your example are all use pre-defined class ...
The mock PersistentStateComponent can have setters to update necessary settings.
Probably, your non-mock PersistentStateComponent has setters too. Can't you just set necessary settings before each run (and reset back to defaults in tearDown)?
Thanks a lot !