Skip to content

Commit

Permalink
Add unit test for bootstrapAll() method in CachingStoreClientFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
afeinberg committed Jan 13, 2011
1 parent f5e6c7f commit ededaf4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/unit/voldemort/client/CachingStoreClientFactoryTest.java
Expand Up @@ -46,4 +46,25 @@ public void testCaching() {
verify(spyFactory, times(1)).getStoreClient("foo");
verify(spyFactory, times(2)).getStoreClient("foo", resolver);
}

@Test
public void testBootstrapAll() {
StoreClientFactory inner = new MockStoreClientFactory(new StringSerializer(),
new StringSerializer(),
null);
DefaultStoreClient<Object, Object> aStoreClient = spy((DefaultStoreClient<Object, Object>) inner.getStoreClient("test1"));
DefaultStoreClient<Object, Object> bStoreClient = spy((DefaultStoreClient<Object, Object>) inner.getStoreClient("test2"));
StoreClientFactory mocked = mock(StoreClientFactory.class);

when(mocked.<Object, Object>getStoreClient("test1")).thenReturn(aStoreClient);
when(mocked.<Object, Object>getStoreClient("test2")).thenReturn(bStoreClient);

CachingStoreClientFactory cachingFactory = new CachingStoreClientFactory(mocked);
cachingFactory.getStoreClient("test1");
cachingFactory.getStoreClient("test2");
cachingFactory.bootstrapAllClients();

verify(aStoreClient, times(1)).bootStrap();
verify(bStoreClient, times(1)).bootStrap();
}
}

0 comments on commit ededaf4

Please sign in to comment.