use of org.mamute.model.User in project mamute by caelum.
the class QuestionTest method should_return_false_if_is__not_author.
@Test
public void should_return_false_if_is__not_author() throws Exception {
User author = user("Fernanda", "bla@bla.com", 1l);
User user = user("Chico", "bla@b.com", 2L);
Question question = question(author);
assertFalse(question.canMarkAsSolution(user));
Answer answer = answer("", question, author);
question.markAsSolvedBy(answer);
assertFalse(question.canMarkAsSolution(user));
}
use of org.mamute.model.User in project mamute by caelum.
the class UpdaterTest method should_update_if_is_moderator.
@Test
public void should_update_if_is_moderator() {
User moderator = user("moderator", "moderator@brutal", nextId()).asModerator();
QuestionInformation newInformation = new QuestionInformation("title", notMarked("description"), new LoggedUser(moderator, null));
UpdateStatus update = updater.update(myQuestion, newInformation);
assertEquals(UpdateStatus.NO_NEED_TO_APPROVE, update);
assertTrue(myQuestion.getHistory().contains(newInformation));
}
use of org.mamute.model.User in project mamute by caelum.
the class SolrQuestionIndexTest method setup.
@Before
public void setup() throws IOException, SolrServerException, InterruptedException {
author = new User(fromTrustedText("Leonardo"), "leo@leo");
eli5 = new Tag("eli5", "Explain Like I'm 5", author);
eli12 = new Tag("eli12", "Explain Like I'm 12", author);
science = new Tag("science", "Science!", author);
hobby = new Tag("hobby", "Hobbies and stuff", author);
whyIsSkyBlue = createQuestion(1L, "Why is the sky blue?", "I wanna know why is sky blue", science, eli5);
whereDoBabiesComeFrom = createQuestion(2L, "Where do babies come from?", "My mom said I came from a bird", science, eli12);
howShipInBottle = createQuestion(3L, "How do they get the ship in the bottle?", "I wanna know this for my school work", hobby);
}
use of org.mamute.model.User in project mamute by caelum.
the class SignupValidatorTest method should_verify_email_without_domain.
@Test
public void should_verify_email_without_domain() {
User user = user("nome muito grande ai meu deus", "invalidgmail.com");
boolean valid = signupValidator.validate(user, VALID_PASSWORD, VALID_PASSWORD);
assertFalse(valid);
}
use of org.mamute.model.User in project mamute by caelum.
the class SignupValidatorTest method should_verify_large_password.
@Test
public void should_verify_large_password() throws Exception {
when(users.existsWithEmail(VALID_EMAIL)).thenReturn(false);
String password = 666 * 100 + "";
User user = user(VALID_USER_NAME, VALID_EMAIL);
boolean valid = signupValidator.validate(user, password, password);
assertFalse(valid);
}
Aggregations