// 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.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; /** * @author Einar M R Rosenvinge */ public class CollectionComparatorTestCase { @Test public void arrayLength() { List shortArr = Arrays.asList("x", "y"); List longArr = Arrays.asList("a", "b", "c", "d", "e"); assertEquals(-1, CollectionComparator.compare(shortArr, longArr)); } @Test public void compareArrays() { List one = Arrays.asList("b", "c", "d", "d", "e"); List two = Arrays.asList("a", "b", "c", "d", "e"); assertEquals(1, CollectionComparator.compare(one, two)); assertEquals(-1, CollectionComparator.compare(two, one)); } @Test public void compareEqualArrays() { List one = Arrays.asList("a", "b", "c", "d", "e"); List two = Arrays.asList("a", "b", "c", "d", "e"); assertEquals(0, CollectionComparator.compare(one, two)); assertEquals(0, CollectionComparator.compare(two, one)); } }