<commit_before>package example04;

import java.util.ArrayList;
import java.util.Collection;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

@RunWith(PowerMockRunner.class)
@PrepareForTest(EmployeeDaoJdbcImpl.class)
public class EmployeeServiceImplTest {
		
	private static Collection<Employee> testData;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		testData = new ArrayList<>();
		testData.add(new Employee("0001", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0002", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0003", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0004", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0005", "<NAME>", "<EMAIL>"));
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		testData = null;
	}

	@Before
	public void setUp() throws Exception {
		
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testSaveEmployee() {
		EmployeeDaoJdbcImpl dao = PowerMockito.mock(EmployeeDaoJdbcImpl.class);
		EmployeeService testObject = new EmployeeServiceImpl(dao);
		PowerMockito.doNothing().when(dao).saveEmployee(Mockito.any(Employee.class));
		testObject.saveEmployee("0006", "<NAME>", "<EMAIL>");
		Mockito.verify(dao).saveEmployee(Mockito.any(Employee.class));
		Mockito.verifyNoMoreInteractions(dao);
	}

	@Test
	public void testGetAllEmployees() {
		EmployeeDao dao = PowerMockito.mock(EmployeeDaoJdbcImpl.class);
		EmployeeService testObject = new EmployeeServiceImpl(dao);
		PowerMockito.doReturn(testData).when(dao).findAllEmployees();
		Collection<Employee> result = testObject.getAllEmployees();
		Assert.assertEquals(5, result.size());
		Mockito.verify(dao).findAllEmployees();
		Mockito.verifyNoMoreInteractions(dao);

	}
	
	@Test
	public void testCountEmployees() {
		EmployeeDao dao = PowerMockito.mock(EmployeeDaoJdbcImpl.class);
		EmployeeService testObject = new EmployeeServiceImpl(dao);
		PowerMockito.doReturn(testData).when(dao).findAllEmployees();
		int result = testObject.countEmployees();
		Assert.assertEquals(5, result);
		Mockito.verify(dao).findAllEmployees();
		Mockito.verifyNoMoreInteractions(dao);
	}

}
<commit_msg>Use Mockito.<commit_after>package example04;

import java.util.ArrayList;
import java.util.Collection;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

@RunWith(PowerMockRunner.class)
@PrepareForTest(EmployeeDaoJdbcImpl.class)
public class EmployeeServiceImplTest {
		
	private static Collection<Employee> testData;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		testData = new ArrayList<>();
		testData.add(new Employee("0001", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0002", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0003", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0004", "<NAME>", "<EMAIL>"));
		testData.add(new Employee("0005", "<NAME>", "<EMAIL>"));
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		testData = null;
	}

	@Before
	public void setUp() throws Exception {
		
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testSaveEmployee() {
		EmployeeDaoJdbcImpl dao = PowerMockito.mock(EmployeeDaoJdbcImpl.class);
		EmployeeService testObject = new EmployeeServiceImpl(dao);
		Mockito.doNothing().when(dao).saveEmployee(Mockito.any(Employee.class));
		testObject.saveEmployee("0006", "<NAME>", "<EMAIL>");
		Mockito.verify(dao).saveEmployee(Mockito.any(Employee.class));
		Mockito.verifyNoMoreInteractions(dao);
	}

	@Test
	public void testGetAllEmployees() {
		EmployeeDao dao = PowerMockito.mock(EmployeeDaoJdbcImpl.class);
		EmployeeService testObject = new EmployeeServiceImpl(dao);
		Mockito.doReturn(testData).when(dao).findAllEmployees();
		Collection<Employee> result = testObject.getAllEmployees();
		Assert.assertEquals(5, result.size());
		Mockito.verify(dao).findAllEmployees();
		Mockito.verifyNoMoreInteractions(dao);

	}
	
	@Test
	public void testCountEmployees() {
		EmployeeDao dao = PowerMockito.mock(EmployeeDaoJdbcImpl.class);
		EmployeeService testObject = new EmployeeServiceImpl(dao);
		Mockito.doReturn(testData).when(dao).findAllEmployees();
		int result = testObject.countEmployees();
		Assert.assertEquals(5, result);
		Mockito.verify(dao).findAllEmployees();
		Mockito.verifyNoMoreInteractions(dao);
	}

}

{'fraction_non_alphanumeric': 0.13542082169924213, 'fraction_numerical': 0.011567610690067811, 'mean_word_length': 6.342606149341142, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '139529', 'n_tokens_mistral': 1750, 'n_tokens_neox': 1597, 'n_words': 287}