Search code examples
javaeclipsedebuggingrad

How to change the constant value in Debug mode


Can anyone advise how to change the given below expression values.

if(StringUtils.equals("Y",dao.getUserStatus("1010")){
          //Conditional true statement
}else{
      //False Statements
}

I would like to change "Y" to "N or dao.getUserStatus("1010") return "N" . Objective is make it Condition false.


Solution

  • AFAIK, you can't

    Extract a variable like this:

    String userStatus = dao.getUserStatus("1010");
    if (StringUtils.equals("Y", userStatus)) { // Breakpoint here
        // Conditional true statement
    } else {
        // False Statements
    }
    

    and change its value.


    Another possible solution is to step into StringUtils#equals and change the result (if possible)