title: Mock an enum using Mockito in Java
body: <p>How can I mock an enum for testing purposes using Mockito? Given this sample for the enum:</p>
  
  <pre><code>public enum TestEnum {
   YES,
   NO
  }
  </code></pre>
  
  <p>and this one for the method using the enum:</p>
  
  <pre><code>public static boolean WorkTheEnum(TestEnum theEnum) {
  switch (theEnum) {
    case YES:
       return true;
    case NO:
       return false;
    default:
       // throws an exception here
   }
  }
  </code></pre>
  
  <p>how can I mock the enum to reach the default branch of the switch loop? <a href="https://stackoverflow.com/questions/25929351/unit-test-for-enum-value-that-doesnt-exist#25930885">This answer</a> says Mockito can't mock enums but the answer has also been provided more than a year ago. Do I can mock an enum meanwhile or have I to let the branch stay untested? Other Mocking frameworks can't be used.</p>