:- begin_tests(jpl_class_to_classname). instance_ref_to_entity_name(InstanceRef,JavaEntityName1,JavaEntityName2) :- jpl_object_to_class(InstanceRef,ClassRef), % this way jpl_class_to_classname(ClassRef,JavaEntityName1), % that way (looking at the implementation, it's exactly the same way!) jpl_call(ClassRef,'getName',[],JavaEntityName2). generic_test(EntityName,Params,N1,N2) :- jpl_new(EntityName,Params,InstanceRef), instance_ref_to_entity_name(InstanceRef,N1,N2). test("concrete class calendar",true([N1,N2] == [EntityName,EntityName])) :- EntityName = 'java.util.GregorianCalendar', generic_test(EntityName,[],N1,N2). test("concrete class integer",true([N1,N2] == [EntityName,EntityName])) :- EntityName = 'java.lang.Integer', generic_test(EntityName,[12],N1,N2). :- end_tests(jpl_class_to_classname).