<commit_before>package com.hida.service;

import com.hida.model.Citation;
import com.hida.repositories.CitationRepository;
import org.mockito.InjectMocks;
import static org.mockito.Matchers.any;
import org.mockito.Mock;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;

/**
 * This class tests the functionality of MinterServiceImpl using Mockito.
 *
 * @author lruffin
 */
public class ResolverServiceImplTest {

    @Mock
    private CitationRepository CitationRepo;

    @InjectMocks
    private ResolverServiceImpl Service;

    /**
     * Sets up Mockito
     *
     * @throws Exception
     */
    @BeforeClass
    public void setUpClass() throws Exception {
        MockitoAnnotations.initMocks(this);
    }

    /**
     * Tests to see if the URL of a given Citation entity is properly retrieved
     */
    @Test
    public void testRetrieveUrl() {
        Citation entity = new Citation();
        entity.setUrl("");
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);

        Service.retrieveUrl("");

        verify(CitationRepo, atLeastOnce()).findOne(any(String.class));
    }

    /**
     * Tests to see if a Citation entity can be edited
     */
    @Test
    public void testEditUrl() {
        Citation entity = new Citation();
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);

        Service.editUrl("", "");
        verify(CitationRepo, atLeastOnce()).findOne(any(String.class));
    }

    /**
     * Tests to see if a Citation entity can be deleted
     */
    @Test
    public void testDeleteCitation() {
        Citation entity = new Citation();
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);
        doNothing().when(CitationRepo).delete(entity);

        Service.deleteCitation("");
        verify(CitationRepo, atLeastOnce()).delete(any(Citation.class));
    }

    /**
     * Tests to see if a Citation entity is retrievable
     */
    @Test
    public void testRetrieveModel() {
        Citation entity = new Citation();
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);

        verify(CitationRepo, atLeastOnce()).findOne(any(String.class));
    }

    /**
     * Tests to see if a Citation object can be persisted
     */
    @Test
    public void testInsertCitation() {
        Citation purl = new Citation();
        doNothing().when(CitationRepo).save(purl);

        Service.insertCitation(purl);
        verify(CitationRepo, atLeastOnce()).save(any(Citation.class));
    }

}
<commit_msg>Replace doNothing method with when<commit_after>package com.hida.service;

import com.hida.model.Citation;
import com.hida.repositories.CitationRepository;
import org.mockito.InjectMocks;
import static org.mockito.Matchers.any;
import org.mockito.Mock;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;

/**
 * This class tests the functionality of MinterServiceImpl using Mockito.
 *
 * @author lruffin
 */
public class ResolverServiceImplTest {

    @Mock
    private CitationRepository CitationRepo;

    @InjectMocks
    private ResolverServiceImpl Service;

    /**
     * Sets up Mockito
     *
     * @throws Exception
     */
    @BeforeClass
    public void setUpClass() throws Exception {
        MockitoAnnotations.initMocks(this);
    }

    /**
     * Tests to see if the URL of a given Citation entity is properly retrieved
     */
    @Test
    public void testRetrieveUrl() {
        Citation entity = new Citation();
        entity.setUrl("");
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);

        Service.retrieveUrl("");

        verify(CitationRepo, atLeastOnce()).findOne(any(String.class));
    }

    /**
     * Tests to see if a Citation entity can be edited
     */
    @Test
    public void testEditUrl() {
        Citation entity = new Citation();
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);

        Service.editUrl("", "");
        verify(CitationRepo, atLeastOnce()).findOne(any(String.class));
    }

    /**
     * Tests to see if a Citation entity can be deleted
     */
    @Test
    public void testDeleteCitation() {
        Citation entity = new Citation();
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);
        doNothing().when(CitationRepo).delete(entity);

        Service.deleteCitation("");
        verify(CitationRepo, atLeastOnce()).delete(any(Citation.class));
    }

    /**
     * Tests to see if a Citation entity is retrievable
     */
    @Test
    public void testRetrieveModel() {
        Citation entity = new Citation();
        when(CitationRepo.findOne(any(String.class))).thenReturn(entity);

        verify(CitationRepo, atLeastOnce()).findOne(any(String.class));
    }

    /**
     * Tests to see if a Citation object can be persisted
     */
    @Test
    public void testInsertCitation() {
        Citation purl = new Citation();
        when(CitationRepo.save(purl)).thenReturn(null);
        

        Service.insertCitation(purl);
        verify(CitationRepo, atLeastOnce()).save(any(Citation.class));
    }

}

{'fraction_non_alphanumeric': 0.1137219730941704, 'fraction_numerical': 0.0, 'mean_word_length': 3.0289017341040463, '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': '1462556', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1605, 'n_words': 362}