@Test public void testStartupFailsIfNoUserCacheSet() throws Exception { VistaAuthenticationProvider provider = new VistaAuthenticationProvider(); provider.setUserDetailsService(mockUserDetailService); assertEquals(NullUserCache.class, provider.getUserCache().getClass()); provider.setUserCache(null); try { provider.afterPropertiesSet(); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertTrue(true); } }
public UserServiceImpl() { saltSource = new ReflectionSaltSource(); ((ReflectionSaltSource) saltSource).setUserPropertyToUse("getUsername"); passwordEncoder = new Md5PasswordEncoder(); userCache = new NullUserCache(); }