Object obj = new Long(5);
// Test just getting a single string back, from each type of object.
String str = null;
String expected_str = null;
Diagnosticable helper_class = null;
// Here the string should come from the Diagnostic object's diag().
str = DiagnosticUtil.toDiagString(diag_obj);
expected_str = "D_T_DiagTestClass1: object with diag interface";
if (str.compareTo(expected_str) != 0)
{
throw T_Fail.testFailMsg(
"DiagnosticUtil.toDiagString() failed, got: (" + str +
"), expected: (" + expected_str + ").");
}
// make sure right class was found.
helper_class = DiagnosticUtil.findDiagnostic(diag_obj);
if (!(helper_class instanceof D_T_DiagTestClass1))
throw T_Fail.testFailMsg("Bad helper class lookup.");
// make sure helper class gives right string.
try
{
str = helper_class.diag();
}
catch (Throwable t)
{
throw T_Fail.testFailMsg(
"Unexpected exception from helper_class.diag() call");