- final IUserManager userManager = mock(IUserManager.class);
- doReturn(AuthResultEnum.AUTH_ACCEPT).when(userManager).authenticate(anyString(), anyString());
-
- final File privateKeyFile = Files.createTempFile("tmp-netconf-test", "pk").toFile();
- privateKeyFile.deleteOnExit();
- String privateKeyPEMString = PEMGenerator.generateTo(privateKeyFile);
- return new AuthProvider(userManager, privateKeyPEMString);
+ AuthProvider mock = mock(AuthProvider.class);
+ doReturn(true).when(mock).authenticated(anyString(), anyString());
+ doReturn(PEMGenerator.generate().toCharArray()).when(mock).getPEMAsCharArray();
+ return mock;