<commit_before>package fi.hsl.parkandride.back;

import static org.assertj.core.api.Assertions.assertThat;

import javax.inject.Inject;

import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import fi.hsl.parkandride.core.back.ServiceRepository;
import fi.hsl.parkandride.core.domain.*;
import fi.hsl.parkandride.dev.DevHelper;

public class ServiceDaoTest extends AbstractDaoTest {

    @Inject
    ServiceRepository serviceDao;

    @Test
    public void get_by_id() {
        Service service = serviceDao.getService(1);
        assertThat(service.id).isEqualTo(1l);
        assertThat(service.name).isEqualTo(new MultilingualString("Hissi", "Elevator", "Elevator"));
    }

    @Test
    public void find_all_defaults() {
        assertThat(serviceDao.findServices(new ServiceSearch()).results).extracting("name.fi").containsExactly(
                "Autopesu",
                "Ensiapu",
                "Esteetön WC",
                "Hissi",
                "Infopiste",
                "Inforuudut",
                "Kameravalvonta",
                "Katettu",
                "Kengänkiillotus",
                "Korjauspalvelu",
                "Käynnistysapu",
                "Lastenrattaiden vuokraus",
                "Lippuautomaatti",
                "Maksu portilla",
                "Maksutiski",
                "Paikkojen varausmahdollisuus",
                "Sateenvarjovuokraus",
                "Valaistus",
                "WC");
    }

    @Test
    public void find_all_sort_by_name_en() {
        ServiceSearch search = new ServiceSearch();
        search.sort = new Sort("name.en");
        assertThat(serviceDao.findServices(search).results).extracting("name.en").containsExactly(
                "Car Wash",
                "Covered",
                "Elevator",
                "Engine ignition aid",
                "First aid",<commit_msg>feat(services): clean up sevrice dao test<commit_after>package fi.hsl.parkandride.back;

import static org.assertj.core.api.Assertions.assertThat;

import javax.inject.Inject;

import org.junit.Test;

import fi.hsl.parkandride.core.back.ServiceRepository;
import fi.hsl.parkandride.core.domain.MultilingualString;
import fi.hsl.parkandride.core.domain.Service;
import fi.hsl.parkandride.core.domain.ServiceSearch;
import fi.hsl.parkandride.core.domain.Sort;

public class ServiceDaoTest extends AbstractDaoTest {

    @Inject
    ServiceRepository serviceDao;

    @Test
    public void get_by_id() {
        Service service = serviceDao.getService(1);
        assertThat(service.id).isEqualTo(1l);
        assertThat(service.name).isEqualTo(new MultilingualString("Hissi", "Elevator", "Elevator"));
    }

    @Test
    public void find_all_defaults() {
        assertThat(serviceDao.findServices(new ServiceSearch()).results).extracting("name.fi").containsExactly(
                "Autopesu",
                "Ensiapu",
                "Esteetön WC",
                "Hissi",
                "Infopiste",
                "Inforuudut",
                "Kameravalvonta",
                "Katettu",
                "Kengänkiillotus",
                "Korjauspalvelu",
                "Käynnistysapu",
                "Lastenrattaiden vuokraus",
                "Lippuautomaatti",
                "Maksu portilla",
                "Maksutiski",
                "Paikkojen varausmahdollisuus",
                "Sateenvarjovuokraus",
                "Valaistus",
                "WC"
        );
    }

    @Test
    public void find_all_sort_by_name_en() {
        ServiceSearch search = new ServiceSearch();
        search.sort = new Sort("name.en");
        assertThat(serviceDao.findServices(search).results).extracting("name.en").containsExactly(
                "Car Wash",
                "Covered",
                "Elevator",
                "Engine ignition aid",
                "First aid",
{'fraction_non_alphanumeric': 0.10639348309059492, 'fraction_numerical': 0.0014811157738829918, 'mean_word_length': 2.107361963190184, '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': '6000954', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1201, 'n_words': 186}