### Question:
DefaultPersisterSelector implements PersisterSelector { @Override public String getPersisterId(final ScopePath scope, final Collection<String> configPersisterIds) { if (configPersisterIds.size() == 0) { throw new IllegalStateException( "DefaultPersisterSelector needs exactly one configuration persister! got: " + configPersisterIds.size()); } if (configPersisterIds.size() > 1) { throw new IllegalStateException( "DefaultPersisterSelector needs exactly one configuration persister! got: " + configPersisterIds.size()); } return configPersisterIds.iterator().next(); }  @Override String getPersisterId(final ScopePath scope, final Collection<String> configPersisterIds);  }### Answer:
@Test public void testReturnSinglePersister() { final DefaultPersisterSelector defaultPersisterSelector = new DefaultPersisterSelector(); final String persisterId = defaultPersisterSelector.getPersisterId(null, Arrays.asList("test")); Assert.assertEquals("test", persisterId); }
@Test(expected = IllegalStateException.class) public void testExceptionIfNoPersister() { final DefaultPersisterSelector defaultPersisterSelector = new DefaultPersisterSelector(); defaultPersisterSelector.getPersisterId(null, Collections.<String> emptyList()); }
@Test(expected = IllegalStateException.class) public void testExceptionIfTwoPersister() { final DefaultPersisterSelector defaultPersisterSelector = new DefaultPersisterSelector(); defaultPersisterSelector.getPersisterId(null, Arrays.asList("test", "test2")); }