New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArrayIndexOutOfBoundsException with Version 5.3.1 #3000
Comments
@jfrantzius We got another one here related to |
Hey. Facing the same outcome with a different use-case: Base class: public class BaseService<E, I extends Serializable> {
...
private BaseRepository<E, I> repository;
...
} Class with injection: public class UnderTest extends BaseService<One, Two> {
private OneRepository oneRepository;
private TwoRepository twoRepository;
} Test: @MockitoSettings
public class JunitTest {
@Mock
OneRepository oneRepository;
@Mock
TwoRepository twoRepository;
@InjectMocks
UnderTest underTest;
} Both repositories implement BaseRepository with different generic types. It works ok on 5.2.0, though the base class repository property is not injected. In 5.3.1, it tries to inject the base class repository field but fails with the error described by @KaiSuchomel. Also works, if there's only one candidate to inject(e.g. only OneRepository) |
Signed-off-by: Harald Fassler <harald.fassler+9974@gmail.com>
We're also affected by this issue. |
Signed-off-by: Harald Fassler <harald.fassler+9974@gmail.com>
Is there a plan to address this? |
Hi @relyativus ,
It would be good to have a self-contained reproducer ... |
Hi @jfrantzius
and the OneRepository and TwoRepository are the implementations that set specific types to generics:
The real-world scenario is based on Spring Data repositories |
Thx, then what are
Just some dumb and empty Pojos? |
@jfrantzius This is the two different implementations of BaseRepository, but with different generics. E.g.
|
@relyativus what I meant is the |
@jfrantzius Oh, I see. Yeah, simple pojos |
Fixes #3000 Co-authored-by: Jörg von Frantzius <joerg.frantzius@aperto.com>
Hey, after migrated to Version 5.3.1 i get the following Error during Testexecution:
The Test runs under 5.1.0 without any Issue!!
The Test looks like the following (just snippets):
Testclass:
Controller:
When i remove the
controllerInstance
(only for testing) field in production code, the test runs.....Anyone a clue whats causing this behaviour.
The text was updated successfully, but these errors were encountered: