### Question:
ConfigurationService { public Collection<Configuration> getAllConfigurations() { return Lists.newArrayList(configurationRepository.findAll()); }  Collection<Configuration> getAllConfigurations(); Configuration getConfigurationById(Long configurationId); Configuration getConfigurationByName(String name); Configuration createConfiguration(Configuration configuration, User user); Configuration updateConfigurationById(Configuration configuration, User user); void deleteConfigurationById(Long configurationId, User user);  }### Answer:
@Test public void getAllConfiguration_expectEmptyCollection() { when(configurationRepository.findAll()).thenReturn(new ArrayList<>()); Collection<Configuration> configurations = configurationService.getAllConfigurations(); Assert.assertTrue(configurations.isEmpty()); }
@Test public void getAllConfiguration_expectCollectionWith2ConfigurationEntities() { Collection<Configuration> dbResult = Arrays.asList(new Configuration(), new Configuration()); when(configurationRepository.findAll()).thenReturn(dbResult); Collection<Configuration> configurations = configurationService.getAllConfigurations(); Assert.assertEquals(2, configurations.size()); }