org.eigenbase.util
Class UtilTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.eigenbase.util.UtilTest
All Implemented Interfaces:
Test

public class UtilTest
extends TestCase

Unit test for Util and other classes in this package.

Since:
Jul 12, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/UtilTest.java#23 $
Author:
jhyde

Nested Class Summary
private static class UtilTest.SerializableEnum
          Enumeration which serializes correctly.
private static class UtilTest.UnserializableEnum
          Enumeration which extends BasicValue does NOT serialize correctly.
 
Constructor Summary
UtilTest(String name)
           
 
Method Summary
private  void assertByteArray(String expected, String bits, int bitCount)
           
private  void assertPrintEquals(String expect, String in, boolean nullMeansNull)
           
private static void assertReversible(String s)
           
static void main(String[] args)
          Runs the test suite.
private static Object serializeAndDeserialize(Object e1)
           
static Test suite()
           
 void testBitString()
          Unit-test for BitString.
 void testCastingList()
          Tests CastingList and Util.cast(java.util.List, java.lang.Class).
 void testDiffLines()
          Tests the difference engine, DiffTestCase.diff(java.io.File, java.io.File).
 void testEnumConstants()
          Tests the methods Util.enumConstants(Class) and Util.enumVal(Class, String).
 void testIterableProperties()
           
 void testPosixTimeZone()
          Tests the Util.toPosix(TimeZone, boolean) method.
 void testPrintEquals()
           
 void testPrintEquals2()
           
 void testPrintEquals3()
           
 void testPrintEquals4()
           
 void testPrintEquals5()
           
 void testScientificNotation()
           
 void testSerializeEnumeratedValues()
          Tests whether EnumeratedValues serialize correctly.
 void testToJavaId()
           
private  String toString(byte[] bytes)
          Converts a byte array to a hex string like "AB, CD".
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UtilTest

public UtilTest(String name)
Method Detail

suite

public static Test suite()
                  throws Exception
Throws:
Exception

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 UnsupportedEncodingException
Throws:
UnsupportedEncodingException

assertPrintEquals

private void assertPrintEquals(String expect,
                               String in,
                               boolean nullMeansNull)

testSerializeEnumeratedValues

public void testSerializeEnumeratedValues()
                                   throws IOException,
                                          ClassNotFoundException
Tests whether EnumeratedValues serialize correctly.

Throws:
IOException
ClassNotFoundException

serializeAndDeserialize

private static Object serializeAndDeserialize(Object e1)
                                       throws IOException,
                                              ClassNotFoundException
Throws:
IOException
ClassNotFoundException

testBitString

public void testBitString()
Unit-test for BitString.


assertReversible

private static void assertReversible(String s)

assertByteArray

private void assertByteArray(String expected,
                             String bits,
                             int bitCount)

toString

private 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, java.lang.Class).


testIterableProperties

public void testIterableProperties()

testDiffLines

public void testDiffLines()
Tests the difference engine, DiffTestCase.diff(java.io.File, java.io.File).


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).


main

public static void main(String[] args)
                 throws Exception
Runs the test suite.

Throws:
Exception