{
Account account = new Account();
accountService.saveAccount( account );
// rate article
Article article = saveArticle();
article = articleService.rate( article.getId(), account.getId(), 5L );
Assert.assertEquals( ( double ) 5, article.calculateRate() );
// rate again to test exception
try
{
articleService.rate( article.getId(), account.getId(), 3L );
Assert.fail( UserAlreadyRated.class.getName() + " should be thrown." );
}
catch ( UserAlreadyRated e )
{
Assert.assertEquals( UserAlreadyRated.class, e.getClass() );