Why JUnit test methods need to be void?
Clash Royale CLAN TAG #URR8PPP Why JUnit test methods need to be void? I've read in lot of places that test methods should/must be void , but no one says what is the reason for this. void I found in MethodValidator the following check without comments/javadocs. if (each.getReturnType() != Void.TYPE) { errors.add(new Exception("Method " + each.getName() + " should be void")); } So why it should be void ? void Why would a unit test be anything other than void? Returning values from a unit tests method makes no sense, so if a unit tests method returns a value, it is probably not a correct unit test or not intended as a unit test. – Mark Rotteveel 10 mins ago 2 Answers 2 ...