Search in sources :

Example 1 with CacheProvider

use of org.sagebionetworks.bridge.cache.CacheProvider in project BridgeServer2 by Sage-Bionetworks.

the class TagControllerTest method getTagsNotCached.

@Test
public void getTagsNotCached() throws Exception {
    when(mockViewCache.getView(eq(CacheKey.tagList()), any())).thenReturn(null);
    CacheProvider mockProvider = mock(CacheProvider.class);
    ViewCache viewCache = new ViewCache();
    viewCache.setCacheProvider(mockProvider);
    viewCache.setObjectMapper(BridgeObjectMapper.get());
    controller.setViewCache(viewCache);
    Map<String, List<String>> map = ImmutableMap.of("a", ImmutableList.of("1", "2", "3"));
    when(mockService.getTags()).thenReturn(map);
    String retValue = controller.getTags();
    assertEquals(retValue, JSON);
}
Also used : ViewCache(org.sagebionetworks.bridge.cache.ViewCache) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) CacheProvider(org.sagebionetworks.bridge.cache.CacheProvider) Test(org.testng.annotations.Test)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 List (java.util.List)1 CacheProvider (org.sagebionetworks.bridge.cache.CacheProvider)1 ViewCache (org.sagebionetworks.bridge.cache.ViewCache)1 Test (org.testng.annotations.Test)1