import static org.junit.Assert.*;
+import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
null,
null
},
+ {
+ {},
+ {},
+ },
{
{ "one", "two", "three" },
{ "one", "two", "three" }
null,
{ "one", "two", "three" }
},
+ {
+ { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) },
+ null
+ },
{
{ "1", "1", "2" },
{ "1", "2", "1" }
{
{ "1", "2", "3" },
{ Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) }
+ },
+ {
+ {},
+ { "1", "2", "3"}
+ },
+ {
+ { "1", "2", "3"},
+ {}
+ },
+ {
+ { "alpha", "beta" },
+ { "a", "b" }
}
};
assertFalse(result);
}
}
+
+ @Test
+ public void testObjHashCode()
+ {
+ Object[] data = {
+ Integer.valueOf(12),
+ "arma virumque cano, Troiae qui primus ab oris",
+ new String[] { null, null, null },
+ new Util()
+ };
+
+ int code = 0;
+
+ code = Util.objHashCode(null);
+ assertEquals(1, code);
+
+ for (Object datum : data) {
+ code = Util.objHashCode(datum);
+ assertEquals(datum.hashCode(), code);
+ }
+ }
+
+ @Test
+ public void testStringify()
+ {
+ final String msg = "Foo bar baz bat bam";
+ SQLException exc = new SQLException(msg);
+ String actual = Util.stringify(exc);
+
+ assertNotNull(actual);
+ assertTrue(actual.contains(msg));
+ assertTrue(actual.contains("SQLException"));
+ assertTrue(actual.contains("testStringify"));
+ }
}