@@ -0,0 +1,2898 @@
+/*%0A * Licensed to Elasticsearch under one or more contributor%0A * license agreements. See the NOTICE file distributed with%0A * this work for additional information regarding copyright%0A * ownership. Elasticsearch licenses this file to you under%0A * the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0A%0Apackage org.elasticsearch.search.aggregations.support;%0A%0Aimport org.elasticsearch.common.io.stream.AbstractWriteableEnumTestCase;%0A%0Aimport java.io.IOException;%0A%0Aimport static org.hamcrest.Matchers.equalTo;%0A%0Apublic class ValuesSourceTypeTests extends AbstractWriteableEnumTestCase %7B%0A%0A    public ValuesSourceTypeTests() %7B%0A        super(ValuesSourceType::fromStream);%0A    %7D%0A%0A    @Override%0A    public void testValidOrdinals() %7B%0A        assertThat(ValuesSourceType.ANY.ordinal(), equalTo(0));%0A        assertThat(ValuesSourceType.NUMERIC.ordinal(), equalTo(1));%0A        assertThat(ValuesSourceType.BYTES.ordinal(), equalTo(2));%0A        assertThat(ValuesSourceType.GEOPOINT.ordinal(), equalTo(3));%0A    %7D%0A%0A    @Override%0A    public void testFromString() %7B%0A        assertThat(ValuesSourceType.fromString(%22any%22), equalTo(ValuesSourceType.ANY));%0A        assertThat(ValuesSourceType.fromString(%22numeric%22), equalTo(ValuesSourceType.NUMERIC));%0A        assertThat(ValuesSourceType.fromString(%22bytes%22), equalTo(ValuesSourceType.BYTES));%0A        assertThat(ValuesSourceType.fromString(%22geopoint%22), equalTo(ValuesSourceType.GEOPOINT));%0A        IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -%3E ValuesSourceType.fromString(%22does_not_exist%22));%0A        assertThat(e.getMessage(),%0A            equalTo(%22No enum constant org.elasticsearch.search.aggregations.support.ValuesSourceType.DOES_NOT_EXIST%22));%0A        expectThrows(NullPointerException.class, () -%3E ValuesSourceType.fromString(null));%0A    %7D%0A%0A    @Override%0A    public void testReadFrom() throws IOException %7B%0A        assertReadFromStream(0, ValuesSourceType.ANY);%0A        assertReadFromStream(1, ValuesSourceType.NUMERIC);%0A        assertReadFromStream(2, ValuesSourceType.BYTES);%0A        assertReadFromStream(3, ValuesSourceType.GEOPOINT);%0A    %7D%0A%0A    @Override%0A    public void testWriteTo() throws IOException %7B%0A        assertWriteToStream(ValuesSourceType.ANY, 0);%0A        assertWriteToStream(ValuesSourceType.NUMERIC, 1);%0A        assertWriteToStream(ValuesSourceType.BYTES, 2);%0A        assertWriteToStream(ValuesSourceType.GEOPOINT, 3);%0A    %7D%0A%7D%0A

Introduce unit tests for ValuesSourceType (#43174)