}
@Test
public void testAuthenticateLoginAccount()
{
Account account = new Account();
account.setLoginType( LoginType.LOGIN );
account.setLogin( "dodo" );
account.setPassword( "1111" );
try
{
accountService.register( account );
}
catch ( Exception e )
{
Assert.fail( "This exception should not be thrown: " + e );
}
SessionUser sessionUser = new SessionUser();
sessionUser.setLogin( account.getLogin() );
sessionUser.setPassword( "1111" );
sessionUser.setLoginType( LoginType.LOGIN );
try
{
Account authorizedAccount = ( Account ) authService.authenticate( sessionUser );
Assert.assertEquals( "dodo", authorizedAccount.getLogin() );
Assert.assertEquals( "b59c67bf196a4758191e42f76670ceba", authorizedAccount.getPassword() );
}
catch ( AuthenticatedException e )
{
Assert.fail( "This exception should not be thrown: " + e );
}