title: Comparing enum in Java
body: <p>I have a DTO with enum type. I wan to test DTO field but not sure how can I do it.</p>
  
  <pre><code>Class MyDto {
    public enum ExamResult { PASS, FAIL };
    private ExamResult result;
    ...
  }
  </code></pre>
  
  <p>I am trying to test the result field in some other class</p>
  
  <pre><code>if(myDto.result.equals("PASS")) {
    //doSomething
  } else {
    //doOtherthing
  }
  </code></pre>
  
  <p>But .equals() always returing me false even it have correct value. So not sure how can I test it.</p>