C
C#2w ago
Whiteboy

✅ 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
Angius
Angius2w ago
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
public class Passthrough : AbstractClass {}
public class Passthrough : AbstractClass {}
You can then instantiate a new Passthrough() and pass it wherever AbstractClass is required
Whiteboy
WhiteboyOP2w ago
Yes, i did just that, but the task was meant not to modify test so idk what will happen, scored 94% tough
Want results from more Discord servers?
Add your server