<commit_before>package org.code2bytes.samples.lambda;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

public class PersonListTest {

	private List<Person> persons;

	@Before
	public void setUp() throws Exception {
		persons = new ArrayList<>();
		persons.add(new Person("Test Person 1", 20));
		persons.add(new Person("Test Person 2", 21));
		persons.add(new Person("Test Person 3", 22));
		persons.add(new Person("Test Person 4", 23));
	}

	@Test
	public void testArraySize() {
		assertEquals("Array should contain 4 elements", 4, persons.size());
	}

	@Test
	public void testForEach() {
		persons.forEach(p -> System.out.println(p.getAgeInYears()));
	}<commit_msg>Add test for calculating sum of ages<commit_after>package org.code2bytes.samples.lambda;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

public class PersonListTest {

	private List<Person> persons;

	@Before
	public void setUp() throws Exception {
		persons = new ArrayList<>();
		persons.add(new Person("Test Person 1", 20));
		persons.add(new Person("Test Person 2", 21));
		persons.add(new Person("Test Person 3", 22));
		persons.add(new Person("Test Person 4", 23));
	}

	@Test
	public void testArraySize() {
		assertThat("array contains 4 elements", 4, equalTo(4));
	}

	@Test
	public void testSum() {
		Integer total = persons.parallelStream().map(p -> p.getAgeInYears())
				.reduce((sum, p) -> sum + p).get();
		assertThat("sum should be 86", 86, equalTo(total));
	}
{'fraction_non_alphanumeric': 0.14099526066350712, 'fraction_numerical': 0.020734597156398103, 'mean_word_length': 4.784246575342466, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '1891647', 'n_tokens_mistral': 601, 'n_tokens_neox': 538, 'n_words': 150}