I have a Aspect that has an Autowired field config and in my unit test I would like to set a mock to config after defining mock behavior.
Aspect:
@Aspect
public class Aspect {
@Autowired
private Configuration config;
...
Unit Test:
@Autowired
private Configuration config;
@Before
public void setup() {
when(config.getInt(TTL)).thenReturn(10000);
// set confing to Aspect
}
I know spring has ReflectionTestUtils.setField
for setting an autowired field, but I don't have a reference to the aspect object.
Aucun commentaire:
Enregistrer un commentaire