While using asserts for e.g
try{
assert email!=null : "Email is required"
} catch (AssertionError ae) {
System.out.println(ae.getMessage());
}
above prints Email is required. Expression: email!=null
I don’t want this extra message Expression: email!=null I know I can substring but thats a hack.
You are mis-using
asserthere. It is not for controlling the flow of your program. You should use anifhere.You should only use
assertwhen you are sure that the condition can not occur. In that case the application should crash and print what went wrong. Be aware that asserts maybe turned off when your application is started.