@Test
public void testBasics() throws Exception {

  ProxyCA proxyCA = spy(new ProxyCA());
  RMContext rmContext = mock(RMContext.class);
  RMStateStore rmStateStore = mock(RMStateStore.class);
  when(rmContext.getStateStore()).thenReturn(rmStateStore);
  ProxyCAManager proxyCAManager = new ProxyCAManager(proxyCA, rmContext);
  proxyCAManager.init(new YarnConfiguration());
  Assert.assertEquals(proxyCA, proxyCAManager.getProxyCA());
  verify(rmContext, times(0)).getStateStore();
  verify(rmStateStore, times(0)).storeProxyCACert(any(), any());
  verify(proxyCA, times(0)).init();
  Assert.assertNull(proxyCA.getCaCert());
  Assert.assertNull(proxyCA.getCaKeyPair());
  proxyCAManager.start();
  verify(rmContext, times(1)).getStateStore();
  verify(rmStateStore, times(1)).storeProxyCACert(proxyCA.getCaCert(),
      proxyCA.getCaKeyPair().getPrivate());
  verify(proxyCA, times(1)).init();
  Assert.assertNotNull(proxyCA.getCaCert());
  Assert.assertNotNull(proxyCA.getCaKeyPair());
}