<commit_before>package org.apache.diana.api;

import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.*;


public class DefaultValueTest {


    @Test(expected = NullPointerException.class)
    public void shouldReturnErrorWhenElementIsNull() {
        Value.of(null);
    }

    @Test
    public void shouldReturnSameInstanteInGet() {
        AtomicInteger number = new AtomicInteger(5_000);
        Value value = Value.of(number);
        assertEquals(number, value.get());
    }

    @Test
    public void shouldConvertType() {
        AtomicInteger number = new AtomicInteger(5_000);
        Value value = Value.of(number);
        assertEquals(Integer.valueOf(5_000), value.get(Integer.class));
        assertEquals("5000", value.get(String.class));
    }

    @Test
    public void shouldConvertToSingletonList() {
        Long number = 10L;
        Value value = Value.of(number);
        assertThat(value.getList(String.class), containsInAnyOrder("10"));
        assertThat(value.getList(Long.class), containsInAnyOrder(10L));
    }

    @Test<commit_msg>Adds stream test in DefaulValue class<commit_after>package org.apache.diana.api;

import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collector;
import java.util.stream.Collectors;

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.*;


public class DefaultValueTest {


    @Test(expected = NullPointerException.class)
    public void shouldReturnErrorWhenElementIsNull() {
        Value.of(null);
    }

    @Test
    public void shouldReturnSameInstanteInGet() {
        AtomicInteger number = new AtomicInteger(5_000);
        Value value = Value.of(number);
        assertEquals(number, value.get());
    }

    @Test
    public void shouldConvertType() {
        AtomicInteger number = new AtomicInteger(5_000);
        Value value = Value.of(number);
        assertEquals(Integer.valueOf(5_000), value.get(Integer.class));
        assertEquals("5000", value.get(String.class));
    }

    @Test
    public void shouldConvertToSingletonList() {
        Long number = 10L;
        Value value = Value.of(number);
        assertThat(value.getList(String.class), containsInAnyOrder("10"));
        assertThat(value.getList(Long.class), containsInAnyOrder(10L));
    }

    @Test
    public void shouldConvertToStream() {
        Long number = 10L;
        Value value = Value.of(number);

        assertThat(value.getStream(String.class).collect(Collectors.toList()), containsInAnyOrder("10"));
        assertThat(value.getStream(Long.class).collect(Collectors.toList()), containsInAnyOrder(10L));
    }

    @Test
{'fraction_non_alphanumeric': 0.11267605633802817, 'fraction_numerical': 0.01564945226917058, 'mean_word_length': 3.6386066763425253, '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': '3315838', 'n_tokens_mistral': 968, 'n_tokens_neox': 929, 'n_words': 182}