private void checkIfAllowed(String someString, STATUS  status){ boolean validStatus = false; if(some condition){    validStatus = true; } if (!validStatus) {    throw new RuntimeException(Some message); }}private void callingMethod(){...checkIfAllowed(test, PENDING);...}Or private boolean checkIfAllowed(String someString, STATUS  status){ if(some condition){    return true; } return false;}private void callingMethod(){...if(!checkIfAllowed(test, PENDING)){  throw new RuntimeException(Some message);}...}which of the above 2 is a better approach given In checkIfAllowed() if the condition is not met it will always resultin an exception taking into consideration testing the checkIfAllowed method.Also In general (without the given) what would you select.
Better method definition
java
Firstly, both of these can use the same simplification: boolean validStatus = false; if(some condition){    validStatus = true; } if (!validStatus) {    throw new RuntimeException(Some message); }can become:if (!some condition) {    throw new RuntimeException(Some message); }And if(some condition){   return true;}return false;can become:return (some condition);As for the main question, if point 1 was not true, then I'd definitely prefer the second version. You should only throw an exception in an exceptional circumstance. If checkIfAllowed does not know whether some condition being false is exceptional, it should not throw an exception, and instead leave that to the caller to decide.Given point 1, I don't think I have a strong preference between the two. I think the best guiding principle here would be the single responsibility principle: which of the two methods is best positioned to take the responsibility of deciding which exception to throw, and with what message?As for testing, I don't think either approach would be particularly easier or harder to test than the other.