most of the time i will use exception to check for condition in my code, i wonder when is appropriate time to use assertion
for instance,
Group group=null;
try{
group = service().getGroup("abc");
}catch(Exception e){
//i dont log error because i know whenever error occur mean group not found
}
if(group !=null)
{
//do something
}
1.can comment on this code and how assertion fit in here or not?
2. i do know that most of the cases, i can just use exception to do checking like above, but i want to know appropriote way to do it "profesionally" =) and when should i use assertion? seem like i never used assertion and only see assertion in unittest