rsaKeyPairGenerator.initialize(2048, secureRandom);
expect(rsaKeyPairGenerator.genKeyPair()).andReturn(keyPair);
replay(crypto, rsaKeyPairGenerator, secureRandom);
RsaSshKeyPairGenerator supplier = Guice.createInjector(new AbstractModule() {
protected void configure() {
bind(Crypto.class).toInstance(crypto);
bind(SecureRandom.class).toInstance(secureRandom);
}
}).getInstance(RsaSshKeyPairGenerator.class);
assertEquals(supplier.get(),
ImmutableMap.of("public", openSshKey, "private", PRIVATE_KEY.replaceAll("\n", lineSeparator)));
verify(crypto, rsaKeyPairGenerator, secureRandom);
}