@Test public void testGetDataUsage() throws PersistenceException { attributesList = new ArrayList<>(); Map<String, Object> attributes = new HashMap<>(); attributes.put(DATA_USAGE_LONG, LONG_1); attributesList.add(attributes); when(persistentStore.get(anyString(), anyString())).thenReturn(attributesList); long usage = attributesStore.getCurrentDataUsageByUser(USER); assertThat(usage, is(LONG_1)); }
@Test public void testPersistenceStoreReturnsEmptyList() throws PersistenceException { when(persistentStore.get(anyString(), anyString())).thenReturn(new ArrayList<>()); assertThat(attributesStore.getCurrentDataUsageByUser(USER), is(0L)); }
@Test(expected = PersistenceException.class) public void testGetDataUsageNullUsername() throws PersistenceException { attributesStore.getCurrentDataUsageByUser(null); }