<commit_before>import java.nio.ByteBuffer;
import java.util.*;
import net.quasardb.qdb.*;
import org.junit.*;
import org.hamcrest.Matcher;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

public class QdbTimeSeriesCreateTest {
    @Test
    public void doesNotThrow_afterCreation() throws Exception {
        QdbTimeSeries series =
            Helpers.createTimeSeries(Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                                                   new QdbColumn.Definition.Double (Helpers.createUniqueAlias())));
    }

    @Test
    public void listsColumns_afterCreation() throws Exception {
        List<QdbColumn.Definition> definitions =
            Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                          new QdbColumn.Definition.Double (Helpers.createUniqueAlias()));

        QdbTimeSeries series = Helpers.createTimeSeries(definitions);

        Iterable<QdbColumn.Definition> result = series.listColumns();

        assertThat(result, (is(definitions)));
    }

    @Test
    public void canAddColumns_afterCreation() throws Exception {
        List<QdbColumn.Definition> definitions1 =
            Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                          new QdbColumn.Definition.Double (Helpers.createUniqueAlias()));

        QdbTimeSeries series = Helpers.createTimeSeries(definitions1);

        Iterable<QdbColumn.Definition> result1 = series.listColumns();
        assertThat(result1, (is(definitions1)));

        List<QdbColumn.Definition> definitions2 =
            Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                          new QdbColumn.Definition.Double (Helpers.createUniqueAlias()));
        series.insertColumns(definitions2);

        Iterable<QdbColumn.Definition> result2 = series.listColumns();

        List<QdbColumn.Definition> allDefinitions = new ArrayList<QdbColumn.Definition> ();
        allDefinitions.addAll(definitions1);
        allDefinitions.addAll(definitions2);

        assertThat(result2, (is(allDefinitions)));
    }
}<commit_msg>Adds tests that validate duplicate columns<commit_after>import java.nio.ByteBuffer;
import java.util.*;
import net.quasardb.qdb.*;
import org.junit.*;
import org.hamcrest.Matcher;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

public class QdbTimeSeriesCreateTest {
    @Test
    public void doesNotThrow_afterCreation() throws Exception {
        QdbTimeSeries series =
            Helpers.createTimeSeries(Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                                                   new QdbColumn.Definition.Double (Helpers.createUniqueAlias())));
    }

    @Test
    public void listsColumns_afterCreation() throws Exception {
        List<QdbColumn.Definition> definitions =
            Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                          new QdbColumn.Definition.Double (Helpers.createUniqueAlias()));

        QdbTimeSeries series = Helpers.createTimeSeries(definitions);

        Iterable<QdbColumn.Definition> result = series.listColumns();

        assertThat(result, (is(definitions)));
    }

    @Test
    public void canAddColumns_afterCreation() throws Exception {
        List<QdbColumn.Definition> definitions1 =
            Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                          new QdbColumn.Definition.Double (Helpers.createUniqueAlias()));

        QdbTimeSeries series = Helpers.createTimeSeries(definitions1);

        Iterable<QdbColumn.Definition> result1 = series.listColumns();
        assertThat(result1, (is(definitions1)));

        List<QdbColumn.Definition> definitions2 =
            Arrays.asList(new QdbColumn.Definition.Blob (Helpers.createUniqueAlias()),
                          new QdbColumn.Definition.Double (Helpers.createUniqueAlias()));
        series.insertColumns(definitions2);

        Iterable<QdbColumn.Definition> result2 = series.listColumns();

        List<QdbColumn.Definition> allDefinitions = new ArrayList<QdbColumn.Definition> ();
        allDefinitions.addAll(definitions1);
        allDefinitions.addAll(definitions2);

        assertThat(result2, (is(allDefinitions)));
    }

    @Test(expected = QdbInvalidArgumentException.class)
    public void throws_afterCreatingDuplicateColumns() throws Exception {
        List<QdbColumn.Definition> definitions =
            Arrays.asList(new QdbColumn.Definition.Blob ("b1"),
                          new QdbColumn.Definition.Double ("b1"));

        QdbTimeSeries series = Helpers.createTimeSeries(definitions);
    }

    @Test(expected = QdbInvalidArgumentException.class)
    public void throws_afterInsertingDuplicateColumns() throws Exception {
        List<QdbColumn.Definition> definitions1 =
            Arrays.asList(new QdbColumn.Definition.Blob ("b2"));

        QdbTimeSeries series = Helpers.createTimeSeries(definitions1);

        List<QdbColumn.Definition> definitions2 =
            Arrays.asList(new QdbColumn.Definition.Double ("b2"));
        series.insertColumns(definitions2);

    }
}
{'fraction_non_alphanumeric': 0.09907179390035992, 'fraction_numerical': 0.005682894487592347, 'mean_word_length': 3.13469068128426, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5996108', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1361, 'n_words': 238}