}
+ @Test
+ public void registerNoUrl()
+ throws Exception
+ {
+ try
+ {
+ UserService service = getUserService();
+ User u = new User();
+ u.setFullName( "the toto" );
+ u.setUsername( "toto" );
+ u.setEmail( "toto@toto.fr" );
+ u.setPassword( "toto123" );
+ u.setConfirmPassword( "toto123" );
+ String key = service.registerUser( new UserRegistrationRequest( u, null ) ).getKey();
+
+ assertFalse( key.equals( "-1" ) );
+
+ ServicesAssert assertService =
+ JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/testsService/",
+ ServicesAssert.class,
+ Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+
+ List<EmailMessage> emailMessages = assertService.getEmailMessageSended();
+ assertEquals( 1, emailMessages.size() );
+ assertEquals( "toto@toto.fr", emailMessages.get( 0 ).getTos().get( 0 ) );
+
+ assertEquals( "Welcome", emailMessages.get( 0 ).getSubject() );
+ String messageContent = emailMessages.get( 0 ).getText();
+
+ log.info( "messageContent: {}", messageContent );
+
+ assertThat( messageContent ).contains( "Use the following URL to validate your account." ).contains(
+ "http://localhost:" + port ).containsIgnoringCase( "toto" );
+
+ assertTrue( service.validateUserFromKey( key ) );
+
+ service = getUserService( authorizationHeader );
+
+ u = service.getUser( "toto" );
+
+ assertNotNull( u );
+ assertTrue( u.isValidated() );
+ assertTrue( u.isPasswordChangeRequired() );
+
+ assertTrue( service.validateUserFromKey( key ) );
+
+ }
+ catch ( Exception e )
+ {
+ log.error( e.getMessage(), e );
+ throw e;
+ }
+ finally
+ {
+ getUserService( authorizationHeader ).deleteUser( "toto" );
+ }
+
+ }
+
@Test
public void resetPassword()
throws Exception