Class UtilTest


  • public class UtilTest
    extends java.lang.Object
    Unit test for Util and other classes in this package.
    • Constructor Detail

      • UtilTest

        public UtilTest()
    • Method Detail

      • setUSLocale

        public static void setUSLocale()
      • testPrintEquals

        public void testPrintEquals()
      • testPrintEquals2

        public void testPrintEquals2()
      • testPrintEquals3

        public void testPrintEquals3()
      • testPrintEquals4

        public void testPrintEquals4()
      • testPrintEquals5

        public void testPrintEquals5()
      • testScientificNotation

        public void testScientificNotation()
      • testToJavaId

        public void testToJavaId()
                          throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException
      • assertPrintEquals

        private void assertPrintEquals​(java.lang.String expect,
                                       java.lang.String in,
                                       boolean nullMeansNull)
      • testTokenize

        public void testTokenize()
        Unit-test for Util.tokenize(String, String).
      • testBitString

        public void testBitString()
        Unit-test for BitString.
      • assertReversible

        private static void assertReversible​(java.lang.String s)
      • assertByteArray

        private void assertByteArray​(java.lang.String expected,
                                     java.lang.String bits,
                                     int bitCount)
      • toString

        private java.lang.String toString​(byte[] bytes)
        Converts a byte array to a hex string like "AB, CD".
      • testCastingList

        public void testCastingList()
        Tests CastingList and Util.cast(java.util.List<? super E>, java.lang.Class<E>).
      • testCons

        public void testCons()
      • testConsPerformance

        public void testConsPerformance()
      • makeConsList

        private java.util.List<java.lang.Integer> makeConsList​(int start,
                                                               int end)
      • testIterableProperties

        public void testIterableProperties()
      • testPosixTimeZone

        public void testPosixTimeZone()
        Tests the Util.toPosix(TimeZone, boolean) method.
      • testEnumConstants

        public void testEnumConstants()
        Tests the methods Util.enumConstants(Class) and Util.enumVal(Class, String).
      • testSqlBuilder

        public void testSqlBuilder()
        Tests SQL builders.
      • testCompositeList

        public void testCompositeList()
        Unit test for CompositeList.
      • testTemplate

        public void testTemplate()
        Unit test for Template.
      • testParseLocale

        public void testParseLocale()
        Unit test for Util.parseLocale(String) method.
      • testSpaces

        public void testSpaces()
      • testSpaceString

        public void testSpaceString()
      • testPairZip

        public void testPairZip()
        Unit test for Pair.zip(java.util.List, java.util.List).
      • testPairAdjacents

        public void testPairAdjacents()
        Unit test for Pair.adjacents(Iterable).
      • testPairFirstAnd

        public void testPairFirstAnd()
        Unit test for Pair.firstAnd(Iterable).
      • testQuotientList

        public void testQuotientList()
        Unit test for Util.quotientList(java.util.List, int, int) and Util.pairs(List).
      • testImmutableIntList

        public void testImmutableIntList()
      • testIntegerIntervalSet

        public void testIntegerIntervalSet()
        Unit test for IntegerIntervalSet.
      • checkIntegerIntervalSet

        private java.util.List<java.lang.Integer> checkIntegerIntervalSet​(java.lang.String s,
                                                                          int... ints)
      • testFlatList

        public void testFlatList()
        Tests that flat lists behave like regular lists in terms of equals and hashCode.
      • testFlatList2

        public void testFlatList2()
      • checkFlatList

        private void checkFlatList​(int n)
      • l1

        private <E> java.util.List<E> l1​(E e)
      • l2

        private <E> java.util.List<E> l2​(E e0,
                                         E e1)
      • l3

        private <E> java.util.List<E> l3​(E e0,
                                         E e1,
                                         E e2)
      • testFlatListN

        public void testFlatListN()
      • testFlatListProduct

        public void testFlatListProduct()
      • testToCamelCase

        public void testToCamelCase()
        Unit test for AvaticaUtils.toCamelCase(String).
      • testCamelToUpper

        public void testCamelToUpper()
        Unit test for AvaticaUtils.camelToUpper(String).
      • testDistinct

        public void testDistinct()
        Unit test for Util.isDistinct(java.util.List).
      • testIntersects

        public void testIntersects()
        Unit test for Util.intersects(java.util.Collection, java.util.Collection).
      • testJsonBuilder

        public void testJsonBuilder()
        Unit test for JsonBuilder.
      • testCompositeMap

        public void testCompositeMap()
      • checkCompositeMap

        private void checkCompositeMap​(java.lang.String[] beatles,
                                       java.util.Map<java.lang.String,​java.lang.Integer> map)
      • testCommaList

        public void testCommaList()
        Tests Util.commaList(java.util.List).
      • testFirstDuplicate

        public void testFirstDuplicate()
        Unit test for Util.firstDuplicate(java.util.List).
      • testIsDistinctBenchmark

        public void testIsDistinctBenchmark()
        Benchmark for Util.isDistinct(java.util.List<E>). Has determined that map-based implementation is better than nested loops implementation if list is larger than about 15.
      • testDistinctList

        public void testDistinctList()
        Unit test for Util.distinctList(List) and Util.distinctList(Iterable).
      • testHash

        public void testHash()
        Unit test for Utilities.hashCode(double).
      • checkHash

        public void checkHash​(double v)
      • testStartsWithList

        public void testStartsWithList()
        Unit test for Util.startsWith(java.util.List<E>, java.util.List<E>).
      • list

        public java.util.List<java.lang.String> list​(java.lang.String... xs)
      • testResources

        public void testResources()
      • checkResourceMethodNames

        private void checkResourceMethodNames​(java.lang.Object resource)
      • testSortedSet

        public void testSortedSet()
        Tests that sorted sets behave the way we expect.
      • checkNav

        private java.util.NavigableSet<java.lang.String> checkNav​(java.util.NavigableSet<java.lang.String> set,
                                                                  java.lang.String s)
      • testImmutableNullableList

        public void testImmutableNullableList()
        Test for ImmutableNullableList.
      • testUnmodifiableArrayList

        public void testUnmodifiableArrayList()
        Test for UnmodifiableArrayList.
      • testImmutableNullableListBuilder

        public void testImmutableNullableListBuilder()
        Test for ImmutableNullableList.Builder.
      • testHuman

        public void testHuman()
      • testImmutableCopy

        public void testImmutableCopy()
        Tests Util.immutableCopy(Iterable).
      • testAsIndexView

        public void testAsIndexView()
      • testRelBuilderExample

        public void testRelBuilderExample()
      • testOrdReverse

        public void testOrdReverse()
      • checkOrdReverse

        private void checkOrdReverse​(java.lang.Iterable<org.apache.calcite.linq4j.Ord<java.lang.String>> reverse1)
      • testParameterName

        public void testParameterName()
                               throws java.lang.NoSuchMethodException
        Tests ReflectUtil.getParameterName(java.lang.reflect.Method, int).
        Throws:
        java.lang.NoSuchMethodException
      • foo

        public static void foo​(int i,
                               int j)
        Dummy method for testParameterName() to inspect.
      • testListToString

        public void testListToString()
      • checkListToString

        private void checkListToString​(java.lang.String... strings)
      • checkLitmus

        private boolean checkLitmus​(int i,
                                    org.apache.calcite.util.Litmus litmus)
      • testNameSet

        public void testNameSet()
        Unit test for NameSet.
      • checkCase0

        private void checkCase0​(java.lang.String s)
      • checkCase1

        private void checkCase1​(java.lang.String s)
      • checkNameSet

        private void checkNameSet​(java.lang.String s,
                                  org.apache.calcite.util.NameSet set)
      • checkNameMap

        private void checkNameMap​(java.lang.String s,
                                  org.apache.calcite.util.NameMap<java.lang.Integer> map)
      • checkNameMultimap

        private void checkNameMultimap​(java.lang.String s,
                                       org.apache.calcite.util.NameMultimap<java.lang.Integer> map)
      • testNameMap

        public void testNameMap()
        Unit test for NameMap.
      • testNameMultimap

        public void testNameMultimap()
        Unit test for NameMultimap.
      • testNlsStringClone

        public void testNlsStringClone()
      • testXmlOutput

        public void testXmlOutput()
      • testTransform

        public void testTransform()
        Tests Util.transform(List, java.util.function.Function).
      • testFilter

        public void testFilter()
        Tests Util.filter(Iterable, java.util.function.Predicate).
      • testSelect

        public void testSelect()
        Tests Util.select(List, List).
      • testEquivalenceSet

        public void testEquivalenceSet()
      • testBlackHoleMap

        public void testBlackHoleMap()
      • isIterable

        private static <E> org.hamcrest.Matcher<java.lang.Iterable<E>> isIterable​(java.lang.Iterable<E> iterable)
      • toList

        private static <E> java.util.List<E> toList​(java.lang.Iterable<E> iterable)
      • mismatchDescription

        static java.lang.String mismatchDescription​(org.hamcrest.Matcher m,
                                                    java.lang.Object item)
      • describe

        static java.lang.String describe​(org.hamcrest.Matcher m)