lundi 9 décembre 2019

Can we inject spring bean and a mocked version of the same at the same time

I have SpringBootTest class at which i am using TokenGenerator class to generate real tokens

@Autowired
private TokenGenerator tokenGenerator;

Now i need to mock one method in that TokenGenerator

can i define a new mocked version of the same bean like

@MockBean
private TokenGenerator mockedTokenGenerator;

Aucun commentaire:

Enregistrer un commentaire