28293031323334
@Resource private Environment environment; @Bean protected UUIDFactory uuidFactory() { return new UUIDFactory(); }
108109110111112113114115116
@Configuration static class MockConfiguration { @Bean public UUIDFactory uuidFactory() { UUIDFactory mockUUIDFactory = spy(new UUIDFactory()); when(mockUUIDFactory.generateUUID()).thenReturn(uuid); return mockUUIDFactory; }
2324252627282930
private User expectedUser = new User(UUID.randomUUID().toString(), "password user", "password@email.com", "Password123"); @Before public void saveUser() { expectedUser.setOneTimeToken(new UUIDFactory().generateUUID()); userDAO.save(expectedUser); }