The problem has been solved. The issue was the HTMLUnitDriver driver that is doing fast execution and the value that I have to compare was not matching with the expected value resulting in method always evaluates to false. Using the FirefoxDriver does the trick.
Thank yall for responding.