Пример #1
0
  @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));
  }
Пример #2
0
 @Test
 public void testPersistenceStoreReturnsEmptyList() throws PersistenceException {
   when(persistentStore.get(anyString(), anyString())).thenReturn(new ArrayList<>());
   assertThat(attributesStore.getCurrentDataUsageByUser(USER), is(0L));
 }
Пример #3
0
 @Test(expected = PersistenceException.class)
 public void testGetDataUsageNullUsername() throws PersistenceException {
   attributesStore.getCurrentDataUsageByUser(null);
 }