I am using Marathon to test a Java Swing Application. A testing tool for Java Swing applications using Jython. Throughout the scope of this question I'm only concerned with two python files.
CallingFile.py:
testObject = getParentOfFooJPanel(get_component('...'))
print(testObject.getClass().getSimpleName()) #this is only here for testing
#if my code works, but this is
#where I get the errors
FileWithMethod.py
def getParentOfFooJPanel(startingComponent):
if (startingComponent.getClass().getSimpleName() == 'FooJPanel')
print(startingComponent.getClass().getSimpleName()) #prints what I would expect
print(startingComponent.getParent().getClass().getSimpleName()) #prints what I would expect
return(startingComponent.getParent())
else:
getParentOfFooJPanel(startingComponent.getParent())
Whenever I try to reference the object in the FileWithMethod.py it behaves as I would expect it to. However, when I return the component(Java object) and try to use it in the CallingFile.py (for now where I call to print the simple name) it says that 'NoneType' object has no attribute 'getClass'. Can Jython not return Java objects? If not, are there any work arounds?