<commit_before>package com.shardis.web.controllers

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.http.HttpHeaders
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient

@RunWith(SpringRunner::class)
@SpringBootTest
@AutoConfigureWebTestClient
class IndexControllerTest {

    @Autowired
    lateinit var webTestClient: WebTestClient

    @Test
    fun index() {
        val html = getHtml("/")
        assertHtmlsCorrect(html)
    }

    @Test
    fun home() {
        val html = getHtml("/")
        assertHtmlsCorrect(html)
    }

    @Test
    fun about() {
        val html = getHtml("/")
        assertHtmlsCorrect(html)
    }

    private fun assertHtmlsCorrect(html: String?) {
        html?.let {
            Assert.assertTrue("Html should be correct", it.contains("""<div id="root"></div>"""))
        }
    }

    private fun getHtml(url: String): String? {
        val responseBody = webTestClient.get()
            .uri(url)
            .header(HttpHeaders.CONTENT_TYPE, "application/json")
            .exchange()
            .expectStatus().isOk
            .expectBody(String::class.java)
            .returnResult()
            .responseBody

        Assert.assertNotNull("Html should be returned", responseBody)
        return responseBody
    }
}<commit_msg>change content type in test<commit_after>package com.shardis.web.controllers

import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.http.HttpHeaders
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient

@RunWith(SpringRunner::class)
@SpringBootTest
@AutoConfigureWebTestClient
class IndexControllerTest {

    @Autowired
    lateinit var webTestClient: WebTestClient

    @Test
    fun index() {
        val html = getHtml("/")
        assertHtmlsCorrect(html)
    }

    @Test
    fun home() {
        val html = getHtml("/")
        assertHtmlsCorrect(html)
    }

    @Test
    fun about() {
        val html = getHtml("/")
        assertHtmlsCorrect(html)
    }

    private fun assertHtmlsCorrect(html: String?) {
        html?.let {
            Assert.assertTrue("Html should be correct", it.contains("""<div id="root"></div>"""))
        }
    }

    private fun getHtml(url: String): String? {
        val responseBody = webTestClient.get()
            .uri(url)
            .header(HttpHeaders.CONTENT_TYPE, "text/html")
            .exchange()
            .expectStatus().isOk
            .expectBody(String::class.java)
            .returnResult()
            .responseBody

        Assert.assertNotNull("Html should be returned", responseBody)
        return responseBody
    }
}
{'fraction_non_alphanumeric': 0.10587873191751308, 'fraction_numerical': 0.0006155740227762388, 'mean_word_length': 2.882915173237754, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3875691', 'n_tokens_mistral': 915, 'n_tokens_neox': 895, 'n_words': 174}