While writing a unit test for my project's main class asunit keeps throwing me this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
whenever i use a stage reference. I understand why this occurs as the .fla's associated class isn't the main class anymore because it's now the test running class, meaning main doesn't have direct access to the stage any more.
Normally i would just not test the main class as all it does is create other objects and pass stage to them, however stage's usage is fairly ingrained into these classes so i need stage to be referenced properly in these classes too or i wont be able to unit test a single thing.
I would like to know if anyone has encountered this problem before, and if there is a workaround to give a different class access to the stage, preferably without changing the class too much. (it would be a shame to have to change the logic of a class just so i can unit test it)