dimanche 26 avril 2020

Finding failed condition from an if statement (which has multiple condition of AND type) in java

I am struggling with some research with the if statements in Java. It goes something like this. Suppose there are multiple conditions inside an if statement joined with AND operator, and the condition fails due to failure of one of the condition. However it is difficult to find which condition failed due to which the whole scenario got failed. I would like to know if there is some operation or logic from which we can identify the condition that caused the failure.

NOTE: Nested if can be done, but it is not that feasible, so would like to get some input from the community. Thanks in advance.

if (!(employee.validateemployee(employee) && employee.Validateweb(message))) {  

    log.info(" Mandatory Validation Failed !!");
    validationHelper.DBinsert(exchange, message);                                   
}

Aucun commentaire:

Enregistrer un commentaire