// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.collections; import org.junit.Test; import java.util.List; import static org.junit.Assert.assertEquals; /** * @author Einar M R Rosenvinge */ public class CollectionComparatorTestCase { @Test public void arrayLength() { List shortArr = List.of("x", "y"); List longArr = List.of("a", "b", "c", "d", "e"); assertEquals(-1, CollectionComparator.compare(shortArr, longArr)); } @Test public void compareArrays() { List one = List.of("b", "c", "d", "d", "e"); List two = List.of("a", "b", "c", "d", "e"); assertEquals(1, CollectionComparator.compare(one, two)); assertEquals(-1, CollectionComparator.compare(two, one)); } @Test public void compareEqualArrays() { List one = List.of("a", "b", "c", "d", "e"); List two = List.of("a", "b", "c", "d", "e"); assertEquals(0, CollectionComparator.compare(one, two)); assertEquals(0, CollectionComparator.compare(two, one)); } }