Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Test failure in eu.europa.ec.empl.edci.issuer.service.WorkBookEuroPassDynamicServiceTest #3

Open
SeSodesa opened this issue Aug 24, 2021 · 2 comments

Comments

@SeSodesa
Copy link

SeSodesa commented Aug 24, 2021

Compilation of the project root pom.xml with the command

mvn clean install -e

fails, as the tests in

eu.europa.ec.empl.edci.issuer.service.WorkBookEuroPassDynamicServiceTest

do not pass. The specific error goes as follows:

-------------------------------------------------------------------------------
Test set: eu.europa.ec.empl.edci.issuer.service.WorkBookEuroPassDynamicServiceTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.556 s <<< FAILURE! - in eu.europa.ec.empl.edci.issuer.service.WorkBookEuroPassDynamicServiceTest
eu.europa.ec.empl.edci.issuer.service.WorkBookEuroPassDynamicServiceTest  Time elapsed: 0.556 s  <<< ERROR!
org.mockito.exceptions.base.MockitoException: 
Unable to initialize @Spy annotated field 'xmlUtil'.
Unable to create mock instance of type 'XmlUtil'
Caused by: org.mockito.exceptions.base.MockitoException: Unable to create mock instance of type 'XmlUtil'
Caused by: org.mockito.creation.instance.InstantiationException: 

Unable to create instance of 'XmlUtil$MockitoMock$449244233'.
Please ensure the target class has a 0-arg constructor and executes cleanly.
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException

Replacing the lines

@Spy
private XmlUtil xmlUtil;

with the lines

@Mock
private XmlUtil xmlUtil;

on lines 55--56 of

edci-issuer/edci-issuer-service/src/test/java/eu/europa/ec/empl/edci/issuer/service/WorkBookEuroPassDynamicServiceTest.java ,

as in not tracking the interactions with the class instance during tests, allows the tests to progress further (still without passing, though). Not sure if this would be beneficial or not, but as of now the project can't be compiled without making this replacement.

@SeSodesa
Copy link
Author

In seems like this same issue occurs in the file

edci-wallet/edci-wallet-service/src/test/java/integration/eu/europa/ec/empl/edci/wallet/service/VerifiablePresentationITest.java

on lines 43--44. Again, no spy object can be constructed for a class. It has to be an instance of said class.

@Esayos
Copy link
Contributor

Esayos commented Sep 20, 2021

Hello @SeSodesa, for the next version, tests will be refactored and this will be corrected. In the meantime please disable the tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants