StringIdAliasServiceEagerImpl implements StringIdAliasService, InitializingBean { @Override public void afterPropertiesSet() throws Exception { Preconditions.checkState(stringIdAliasDao != null); if (executorService == null) { log.warn("executorService is not set. Will create own one"); executorService = Executors.newSingleThreadExecutor(); } aliasesFuture = executorService.submit(aliasesBackgroundResolver); }  @Override void afterPropertiesSet(); @Override long getAliasFor(String str); @Override String getNameByAlias(long alias); StringIdAliasDao getStringIdAliasDao(); void setStringIdAliasDao(StringIdAliasDao stringIdAliasDao); ExecutorService getExecutorService(); void setExecutorService(ExecutorService executorService);  }
@Test(expected = IllegalStateException.class) public void testInitialization_defensive_expectExceptionIfDaoIsNotSet() throws Exception { StringIdAliasServiceEagerImpl fixture = new StringIdAliasServiceEagerImpl(); fixture.afterPropertiesSet(); }