Dymension
Dymension
JCHJava Community | Help. Code. Learn.
Created by Dymension on 12/26/2024 in #java-help
in java how to use Spy for a class with no no-arg constructor
when i use @Spy annotation i get this error,
org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'videoTranscriptService'.
Please ensure that the type 'VideoTranscriptService' has a no-arg constructor.
org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'videoTranscriptService'.
Please ensure that the type 'VideoTranscriptService' has a no-arg constructor.
i need to use it as im mocking static classes in there, but it doesnt seem to work for classes with no no-arg constructor.
3 replies
JCHJava Community | Help. Code. Learn.
Created by Dymension on 12/23/2024 in #java-help
how do i unit test singleton classes in java?
specifically using mockito and junit
7 replies