title: Unit Test for Enum value that doesn't exist?
body: <p>Some example code first...</p>
  
  <p>The enum:</p>
  
  <pre><code>public enum TestEnum {
     YES,
     NO
  }
  </code></pre>
  
  <p>Some code:</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><strong>Problem:</strong><br>
  The TestEnum is something I import from a different code of a different developer. So it actually could change. For this case I want to have a unit test that actually checks for that non existing value. But I simply don't know how to do it with Mockito and JUnit.</p>
  
  <p>This part is of course not working:</p>
  
  <pre><code>@Test(expected=Exception.class)
  public void DoesNotExist_throwsException() throws Exception {
      when(TestEnum.MAYBE).thenReturn(TestEnum.MAYBE);
      WorkTheEnum(TestEnum.MAYBE);
  }
  </code></pre>
  
  <p>I found one example that usees PowerMock, but I couldn't get it to work with Mockito.</p>
  
  <p>Any ideas?</p>