>What if you don't test with the right sub-class? What if it's an int, but it's out of the range you expect?
Type systems can do all this and more.
https://github.com/milessabin/shapeless/wiki/Feature-overvie...
They can assure you handle all possible control flow cases with ADTs and pattern matching, they can facilitate automated testing, etc.
Just because it's not how java/c# do it, doesn't mean it's a limitation of 'typing'.