<commit_before>package pl.hypeapp.episodie.dataproviders.database.tvshow;

import org.junit.Ignore;
import org.junit.Test;
import pl.hypeapp.core.entity.TvShowEntity;
import pl.hypeapp.core.entity.api.tvmaze.TvShowRemote;
import pl.hypeapp.core.entity.database.TvShowDatabaseAdapter;
import pl.hypeapp.core.entity.database.TvShowLocal;

import java.util.LinkedList;
import java.util.List;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;

public class TvShowDatabaseProviderTest {
    private TvShowRepository tvShowRepository = mock(TvShowRepository.class);

    private TvShowDatabaseProvider tvShowDatabaseProvider = new TvShowDatabaseProvider(tvShowRepository);

    @Test
    @Ignore
    public void shouldCallSaveOnRepository() throws Exception {
        TvShowEntity tvShowEntity = new TvShowRemote();
        TvShowDatabaseAdapter tvShowDatabaseAdapter = new TvShowDatabaseAdapter((TvShowRemote) tvShowEntity);
        TvShowLocal tvShowLocal = any(TvShowLocal.class);

        when(tvShowDatabaseAdapter.apply()).thenReturn(tvShowLocal);

        when(tvShowRepository.save(tvShowLocal)).thenReturn(tvShowLocal);

        tvShowDatabaseProvider.insertTvShow(tvShowEntity);

        verify(tvShowRepository, times(1)).save(tvShowLocal);
    }

    @Test
    public void shouldGetUpdates() throws Exception {
        List<Object[]> updatesFromDatabase = new LinkedList<>();

        when(tvShowRepository.getUpdates()).thenReturn(updatesFromDatabase);

        tvShowDatabaseProvider.getUpdates();

        verify(tvShowRepository, times(1)).getUpdates();
    }

}<commit_msg>Created test for does tv show exist.<commit_after>package pl.hypeapp.episodie.dataproviders.database.tvshow;

import org.junit.Ignore;
import org.junit.Test;
import pl.hypeapp.core.entity.TvShowEntity;
import pl.hypeapp.core.entity.api.tvmaze.TvShowRemote;
import pl.hypeapp.core.entity.database.TvShowDatabaseAdapter;
import pl.hypeapp.core.entity.database.TvShowLocal;

import java.util.LinkedList;
import java.util.List;

import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;

public class TvShowDatabaseProviderTest {
    private TvShowRepository tvShowRepository = mock(TvShowRepository.class);

    private TvShowDatabaseProvider tvShowDatabaseProvider = new TvShowDatabaseProvider(tvShowRepository);

    @Test
    @Ignore
    public void shouldCallSaveOnRepository() throws Exception {
        TvShowEntity tvShowEntity = new TvShowRemote();
        TvShowDatabaseAdapter tvShowDatabaseAdapter = new TvShowDatabaseAdapter((TvShowRemote) tvShowEntity);
        TvShowLocal tvShowLocal = any(TvShowLocal.class);

        when(tvShowDatabaseAdapter.apply()).thenReturn(tvShowLocal);

        when(tvShowRepository.save(tvShowLocal)).thenReturn(tvShowLocal);

        tvShowDatabaseProvider.insertTvShow(tvShowEntity);

        verify(tvShowRepository, times(1)).save(tvShowLocal);
    }

    @Test
    public void shouldGetUpdates() throws Exception {
        List<Object[]> updatesFromDatabase = new LinkedList<>();

        when(tvShowRepository.getUpdates()).thenReturn(updatesFromDatabase);

        tvShowDatabaseProvider.getUpdates();

        verify(tvShowRepository, times(1)).getUpdates();
    }

    @Test
    public void shouldCheckDoesEntityExist() throws Exception {
        String tvMazeId = "82";

        when(tvShowRepository.doesTvShowExist(tvMazeId)).thenReturn(true);

        boolean doesExist = tvShowDatabaseProvider.doesTvShowExist(tvMazeId);

        assertTrue(doesExist);
    }

}
{'fraction_non_alphanumeric': 0.09442896935933148, 'fraction_numerical': 0.001671309192200557, 'mean_word_length': 4.672985781990521, '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': '4829938', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1043, 'n_words': 171}