<commit_before>package sagan.questions.support;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Test;
import org.springframework.test.web.servlet.MvcResult;
import saganx.AbstractIntegrationTests;

import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

public class QuestionsIndexTests extends AbstractIntegrationTests {

    @Test
    public void showsQuestionsIndex() throws Exception {
        MvcResult result = mockMvc.perform(get("/questions")).andExpect(status().isOk())
                .andExpect(content().contentTypeCompatibleWith("text/html")).andReturn();

        Document document = Jsoup.parse(result.getResponse().getContentAsString());

        // questions
        assertThat(document.select("body").text(), containsString("QUESTIONS"));

        // tags
        assertThat(document.select("body").text(), containsString("Spring Framework"));
        assertThat(document.select("body").text(), containsString("spring-framework"));
        assertThat(document.select("body").text(), containsString("spring-core"));
        assertThat(document.select("body").text(), containsString("Spring Data"));
        assertThat(document.select("body").text(), containsString("spring-data"));
        assertThat(document.select("body").text(), containsString("spring-data-mongodb"));
    }
}<commit_msg>Add failing assertions that test for presence of tags in seed data<commit_after>package sagan.questions.support;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Test;
import org.springframework.test.web.servlet.MvcResult;
import saganx.AbstractIntegrationTests;

import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

public class QuestionsIndexTests extends AbstractIntegrationTests {

    @Test
    public void showsQuestionsIndex() throws Exception {
        MvcResult result = mockMvc.perform(get("/questions")).andExpect(status().isOk())
                .andExpect(content().contentTypeCompatibleWith("text/html")).andReturn();

        Document document = Jsoup.parse(result.getResponse().getContentAsString());

        // questions
        assertThat(document.select("body").text(), containsString("QUESTIONS"));

        // see seed data in sagan-common/src/main/resources/database/V4__stackoverflow_tags.sql
        assertThat(document.select("body").text(), containsString("Spring Framework"));
        assertThat(document.select("body").text(), containsString("spring-framework"));
        assertThat(document.select("body").text(), containsString("spring-core"));
        assertThat(document.select("body").text(), containsString("dependency-injection"));
        assertThat(document.select("body").text(), containsString("Spring Data"));
        assertThat(document.select("body").text(), containsString("spring-data"));
        assertThat(document.select("body").text(), containsString("spring-data-mongodb"));
        assertThat(document.select("body").text(), containsString("spring-data-neo4j"));
    }
}
{'fraction_non_alphanumeric': 0.13800779076238176, 'fraction_numerical': 0.0005564830272676684, 'mean_word_length': 5.113945578231292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4941603', 'n_tokens_mistral': 928, 'n_tokens_neox': 925, 'n_words': 145}