✅ Testing an abstract class
NOTE: Because SomeClass is an abstract class, you'll need to create a subclass in order to use most of this functionality. This ensures that the specific details associated with a given bank account type can be handled appropriately.
i don't understand that, i have some tests to pass ( I can't modify them ) and they take SomeClass and try to make instance of it and test methods inside, how do i pass those tests?
2 Replies
Don't test abstract classes, test classes that inherit from it
An abstract class cannot be instantiated
A class that inherits from it, can
Even if it's just a simple passthrough like
You can then instantiate a
new Passthrough()
and pass it wherever AbstractClass
is requiredYes, i did just that, but the task was meant not to modify test so idk what will happen, scored 94% tough