@Test public void testSuitabilityOnAdd() throws Exception { final BlobStoreInfo info = mock(BlobStoreInfo.class); when(info.getName()).thenReturn("testStore"); when(info.isEnabled()).thenReturn(true); BlobStore subStore = mock(BlobStore.class); when(info.createInstance(Mockito.any(), Mockito.any())) .thenAnswer( invocation -> { assertThat( CompositeBlobStore.getStoreSuitabilityCheck(), equalTo(CompositeBlobStore.StoreSuitabilityCheck.EXISTING)); return subStore; }); store = create(); store.handleAddBlobStore(info); verify(info).createInstance(Mockito.any(), Mockito.any()); }
@Test public void testNonDefaultSuitabilityOnAdd() throws Exception { suitability.setValue(CompositeBlobStore.StoreSuitabilityCheck.EMPTY); final BlobStoreInfo info = mock(BlobStoreInfo.class); when(info.getName()).thenReturn("testStore"); when(info.isEnabled()).thenReturn(true); BlobStore subStore = mock(BlobStore.class); when(info.createInstance(Mockito.any(), Mockito.any())) .thenAnswer( invocation -> { assertThat( CompositeBlobStore.getStoreSuitabilityCheck(), equalTo(CompositeBlobStore.StoreSuitabilityCheck.EMPTY)); return subStore; }); store = create(); store.handleAddBlobStore(info); verify(info).createInstance(Mockito.any(), Mockito.any()); }