Search in sources :

Example 81 with User

use of org.mamute.model.User in project mamute by caelum.

the class QuestionTest method should_verify_show_mark_as_solution_rules_for_author.

@Test
public void should_verify_show_mark_as_solution_rules_for_author() throws Exception {
    User author = user("Fernanda", "bla@bla.com", 1l);
    Question question = question(author);
    assertFalse(question.canMarkAsSolution(author));
    question.add(answer("", question, author));
    assertTrue(question.canMarkAsSolution(author));
}
Also used : User(org.mamute.model.User) Question(org.mamute.model.Question) Test(org.junit.Test)

Example 82 with User

use of org.mamute.model.User in project mamute by caelum.

the class QuestionTest method should_verify_that_a_user_already_flagged_question.

@Test
public void should_verify_that_a_user_already_flagged_question() throws Exception {
    Question q = question.build();
    User author = user("author", "author@brutal.com", 1l);
    User other = user("other", "other@brutal.com", 2l);
    Flag flag = flag(FlagType.OTHER, author);
    q.add(flag);
    assertTrue(q.alreadyFlaggedBy(author));
    assertFalse(q.alreadyFlaggedBy(other));
}
Also used : User(org.mamute.model.User) Question(org.mamute.model.Question) Flag(org.mamute.model.Flag) Test(org.junit.Test)

Example 83 with User

use of org.mamute.model.User in project mamute by caelum.

the class QuestionTest method should_verify_if_is_visible_for_author.

@Test
public void should_verify_if_is_visible_for_author() {
    User author = user("leo", "leo@leo");
    Question shouldILiveForever = question.withAuthor(author).build();
    shouldILiveForever.remove();
    boolean isVisibleForAuthor = shouldILiveForever.isVisibleFor(author);
    assertTrue(isVisibleForAuthor);
}
Also used : User(org.mamute.model.User) Question(org.mamute.model.Question) Test(org.junit.Test)

Example 84 with User

use of org.mamute.model.User in project mamute by caelum.

the class QuestionTest method should_set_author_only_once.

@Test
public void should_set_author_only_once() throws Exception {
    Question q = question.build();
    User original = user("original", "original@brutal.com");
    q.setAuthor(original);
    User other = user("other", "other@brutal.com");
    q.setAuthor(other);
    assertEquals(original, q.getAuthor());
}
Also used : User(org.mamute.model.User) Question(org.mamute.model.Question) Test(org.junit.Test)

Example 85 with User

use of org.mamute.model.User in project mamute by caelum.

the class QuestionTest method should_be_touched_by_original_author_after_edit.

@Test
public void should_be_touched_by_original_author_after_edit() throws Exception {
    User artur = user("artur", "artur@x.com");
    artur.setId(1l);
    Question comoFaz = question.withTitle("titulo").withDescription("descricao").withAuthor(artur).build();
    User leo = user("leo", "leo@x.com");
    leo.setId(2l);
    QuestionInformation info = new QuestionInformationBuilder().with(leo).build();
    comoFaz.updateWith(info, updater);
    assertEquals(comoFaz.getLastTouchedBy().getId(), artur.getId());
}
Also used : User(org.mamute.model.User) QuestionInformationBuilder(org.mamute.model.QuestionInformationBuilder) Question(org.mamute.model.Question) QuestionInformation(org.mamute.model.QuestionInformation) Test(org.junit.Test)

Aggregations

User (org.mamute.model.User)97 Test (org.junit.Test)56 Question (org.mamute.model.Question)28 LoggedUser (org.mamute.model.LoggedUser)25 VRaptorTestResult (br.com.caelum.vraptor.test.VRaptorTestResult)9 UserFlow (br.com.caelum.vraptor.test.requestflow.UserFlow)9 Answer (org.mamute.model.Answer)9 LoginMethod (org.mamute.model.LoginMethod)9 Post (br.com.caelum.vraptor.Post)7 Before (org.junit.Before)7 Tag (org.mamute.model.Tag)7 QuestionInformation (org.mamute.model.QuestionInformation)6 Email (org.apache.commons.mail.Email)5 UserPersonalInfo (org.mamute.dto.UserPersonalInfo)5 ReputationEvent (org.mamute.model.ReputationEvent)5 ArrayList (java.util.ArrayList)4 Watcher (org.mamute.model.watch.Watcher)4 DateTime (org.joda.time.DateTime)3 Elements (org.jsoup.select.Elements)3 DaoManager (org.mamute.integration.util.DaoManager)3