<commit_before>package pl.hypeapp.episodie.entrypoints.job.tvshow.update;

import org.junit.Test;
import pl.hypeapp.core.usecase.tvshow.toplist.collectimdbtoptvshows.CollectImdbTopTvShowsException;
import pl.hypeapp.core.usecase.tvshow.update.UpdateTvShowsException;
import pl.hypeapp.core.usecase.tvshow.update.UpdateTvShowsUseCase;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.*;

public class UpdateTvShowsJobTest {
    private UpdateTvShowsUseCase updateTvShowsUseCase = mock(UpdateTvShowsUseCase.class);
    private UpdateTvShowsJobResult updateTvShowsJobResult = mock(UpdateTvShowsJobResult.class);

    private UpdateTvShowsJob updateTvShowsJob = new UpdateTvShowsJob(updateTvShowsUseCase,
            updateTvShowsJobResult);

    @Test
    public void shouldRunJobUseCaseAndAuditSuccess() throws Exception {
        updateTvShowsJob.run();

        verify(updateTvShowsUseCase, times(1)).update();
        verify(updateTvShowsJobResult, times(1)).recordJobSuccessfulResult();
    }

    @Test
    public void shouldThrowExceptionAndAuditUnSuccessfulJob() throws Exception {
        UpdateTvShowsException updateTvShowsException = new UpdateTvShowsException();
        doThrow(updateTvShowsException).when(updateTvShowsUseCase).update();

        updateTvShowsJob.run();

        assertThatExceptionOfType(CollectImdbTopTvShowsException.class).isThrownBy(() -> updateTvShowsUseCase.update());
        verify(updateTvShowsJobResult, times(1)).recordJobUnsuccessfulResult(updateTvShowsException.getMessage());
    }

    @Test
    public void jobHasAllDetails() throws Exception {
        assertThat(updateTvShowsJob.getName()).isNotEmpty();
        assertThat(updateTvShowsJob.getInitialDelay()).isNotNull();
        assertThat(updateTvShowsJob.getPeriod()).isNotNull();
        assertThat(updateTvShowsJob.getTimeUnit()).isNotNull();
    }

}<commit_msg>Fixed test<commit_after>package pl.hypeapp.episodie.entrypoints.job.tvshow.update;

import org.junit.Test;
import pl.hypeapp.core.usecase.tvshow.update.UpdateTvShowsException;
import pl.hypeapp.core.usecase.tvshow.update.UpdateTvShowsUseCase;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.*;

public class UpdateTvShowsJobTest {
    private UpdateTvShowsUseCase updateTvShowsUseCase = mock(UpdateTvShowsUseCase.class);
    private UpdateTvShowsJobResult updateTvShowsJobResult = mock(UpdateTvShowsJobResult.class);

    private UpdateTvShowsJob updateTvShowsJob = new UpdateTvShowsJob(updateTvShowsUseCase,
            updateTvShowsJobResult);

    @Test
    public void shouldRunJobUseCaseAndAuditSuccess() throws Exception {
        updateTvShowsJob.run();

        verify(updateTvShowsUseCase, times(1)).update();
        verify(updateTvShowsJobResult, times(1)).recordJobSuccessfulResult();
    }

    @Test
    public void shouldThrowExceptionAndAuditUnSuccessfulJob() throws Exception {
        UpdateTvShowsException updateTvShowsException = new UpdateTvShowsException();
        doThrow(updateTvShowsException).when(updateTvShowsUseCase).update();

        updateTvShowsJob.run();

        assertThatExceptionOfType(UpdateTvShowsException.class).isThrownBy(() -> updateTvShowsUseCase.update());
        verify(updateTvShowsJobResult, times(1)).recordJobUnsuccessfulResult(updateTvShowsException.getMessage());
    }

    @Test
    public void jobHasAllDetails() throws Exception {
        assertThat(updateTvShowsJob.getName()).isNotEmpty();
        assertThat(updateTvShowsJob.getInitialDelay()).isNotNull();
        assertThat(updateTvShowsJob.getPeriod()).isNotNull();
        assertThat(updateTvShowsJob.getTimeUnit()).isNotNull();
    }

}
{'fraction_non_alphanumeric': 0.09390402075226978, 'fraction_numerical': 0.0015564202334630351, 'mean_word_length': 5.209339774557166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5533707', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1198, 'n_words': 145}