<commit_before>package br.com.caelum.brutal.dao;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Test;

import br.com.caelum.brutal.integracao.dao.DatabaseTestCase;
import br.com.caelum.brutal.model.Answer;
import br.com.caelum.brutal.model.Comment;
import br.com.caelum.brutal.model.CommentAndSubscribedUser;
import br.com.caelum.brutal.model.Question;
import br.com.caelum.brutal.model.User;

public class CommentDAOTest extends DatabaseTestCase {

    @Test
    public void should_find_recent_comments_and_subscribed_users() {
        CommentDAO comments = new CommentDAO(session);
        
        User questionAuthor = new User("question author", "<EMAIL>", "1234");
        User otherQuestionAuthor = new User("question author", "<EMAIL>", "1234");
        User answerAuthor = new User("answer author", "<EMAIL>", "1234");
        User commentAuthor = new User("comment author", "<EMAIL>", "1234");
        
        Question question = new Question("question question question question", "description description description description description");
        question.setAuthor(questionAuthor);
        Answer answer = new Answer("blablablablablablablablablabla", question, answerAuthor);
        
        Question otherQuestion = new Question("question question question question", "description description description description description");
        question.setAuthor(otherQuestionAuthor);
        Answer otherAnswer = new Answer("blablablablablablablablablabla", otherQuestion, answerAuthor);
        
        Comment comment = new Comment(commentAuthor, "commentcommentcommentcommentcomment");
        question.add(comment);
        
        session.save(questionAuthor);
        session.save(answerAuthor);
        session.save(commentAuthor);
        session.save(otherQuestionAuthor);
        session.save(comment);
        session.save(question);
        session.save(answer);
        session.save(otherQuestion);
        session.save(otherAnswer);
        
        List<CommentAndSubscribedUser> recentComments = comments.getRecentAnswersAndSubscribedUsers(3);
        <commit_msg>fixing test<commit_after>package br.com.caelum.brutal.dao;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Test;

import br.com.caelum.brutal.integracao.dao.DatabaseTestCase;
import br.com.caelum.brutal.model.Answer;
import br.com.caelum.brutal.model.Comment;
import br.com.caelum.brutal.model.CommentAndSubscribedUser;
import br.com.caelum.brutal.model.Question;
import br.com.caelum.brutal.model.User;

public class CommentDAOTest extends DatabaseTestCase {

    @Test
    public void should_find_recent_comments_and_subscribed_users() {
        CommentDAO comments = new CommentDAO(session);
        
        User questionAuthor = new User("question author", "<EMAIL>", "1234");
        User otherQuestionAuthor = new User("question author", "<EMAIL>", "1234");
        User answerAuthor = new User("answer author", "<EMAIL>", "1234");
        User commentAuthor = new User("comment author", "<EMAIL>", "1234");
        
        Question question = new Question("question question question question", "description description description description description", questionAuthor);
        Answer answer = new Answer("blablablablablablablablablabla", question, answerAuthor);
        
        Question otherQuestion = new Question("question question question question", "description description description description description", otherQuestionAuthor);
        Answer otherAnswer = new Answer("blablablablablablablablablabla", otherQuestion, answerAuthor);
        
        Comment comment = new Comment(commentAuthor, "commentcommentcommentcommentcomment");
        question.add(comment);
        
        session.save(questionAuthor);
        session.save(answerAuthor);
        session.save(commentAuthor);
        session.save(otherQuestionAuthor);
        session.save(comment);
        session.save(question);
        session.save(answer);
        session.save(otherQuestion);
        session.save(otherAnswer);
        
        List<CommentAndSubscribedUser> recentComments = comments.getRecentAnswersAndSubscribedUsers(3);
        
{'fraction_non_alphanumeric': 0.10085227272727272, 'fraction_numerical': 0.008049242424242424, 'mean_word_length': 3.8230593607305936, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5009729', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1102, 'n_words': 237}