StatisticsServiceImpl implements StatisticsService { @Override public List<DataPoint> findByAccountName(String accountName) { Assert.hasLength(accountName); return repository.findByIdAccount(accountName); }  @Override List<DataPoint> findByAccountName(String accountName); @Override DataPoint save(String accountName, Account account);  }
@Test public void shouldFindDataPointListByAccountName() { final List<DataPoint> list = ImmutableList.of(new DataPoint()); when(repository.findByIdAccount("test")).thenReturn(list); List<DataPoint> result = statisticsService.findByAccountName("test"); assertEquals(list, result); }
@Test(expected = IllegalArgumentException.class) public void shouldFailToFindDataPointWhenAccountNameIsNull() { statisticsService.findByAccountName(null); }
@Test(expected = IllegalArgumentException.class) public void shouldFailToFindDataPointWhenAccountNameIsEmpty() { statisticsService.findByAccountName(""); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldFailToFindDataPointWhenAccountNameIsNull() { statisticsService.findByAccountName(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldFailToFindDataPointWhenAccountNameIsEmpty() { statisticsService.findByAccountName(""); }