title: How to test default value in enum using mockito and testNg
body: <p>I have a third party enum class like this:</p>
  
  <pre><code>package se.api;
  public enum InvestigationResultStatus {
    PENDING("PendingResult.rr"),
    NEW("NewResult.rr"),
    MODIFIED("ModifiedResult.rr"),
    FINAL("FinalResult.rr"),
    PRELIMINARY("PreliminaryResult.rr"),
    ADDITIONAL("AdditionalResult.rr"),
    REJECTED("RejectedResult.rr"),
    COMPLETE("Path.Results.InvestigationInformation.Complete"),
    UNDEFINED("");
  
    private final String languageKey;
  
    private InvestigationResultStatus(String languageKey) {
      this.languageKey = languageKey;
    }
  
    public String getLanguageKey() {
      return this.languageKey;
    }
  }
  </code></pre>
  
  <p>and in my code I create enum for this class </p>
  
  <pre><code>package se.dto;
  public enum InvestigationResultStatus
  {
     PENDING,
     NEW,
     MODIFIED,
     FINAL,
     PRELIMINARY,
     ADDITIONAL,
     REJECTED,
     UNDEFINED
  }
  </code></pre>
  
  <p>to map these api enum to my enum i created enum mapper:</p>
  
  <pre><code>package se.mapper;
  
  import se.dto.InvestigationResultStatus;
  
  public class InvestigationResultStatusMapper
  {
    public InvestigationResultStatus mapOmResultStatusToNovaResultStatus(final se.api.InvestigationResultStatus investigationResultStatus){
      switch (investigationResultStatus){
        case PENDING:
          return InvestigationResultStatus.PENDING;
        case NEW:
          return InvestigationResultStatus.NEW;
        case MODIFIED:
          return InvestigationResultStatus.MODIFIED;
        case FINAL:
          return InvestigationResultStatus.FINAL;
        case PRELIMINARY:
          return InvestigationResultStatus.PRELIMINARY;
        case ADDITIONAL:
          return InvestigationResultStatus.ADDITIONAL;
        case REJECTED:
          return InvestigationResultStatus.REJECTED;
        case UNDEFINED:
          return InvestigationResultStatus.UNDEFINED;
        default:
          throw new IllegalArgumentException("Unknown InvestigationResultStatus: " + investigationResultStatus);
      }
    }
  }
  </code></pre>
  
  <p>Now I want to test the InvestigationResultStatusMapper class default case path and throw IllegalArgumentException. I search and try it in many ways.But mosta of the examples are in using powermockito.but i want mackito with testNg.How can I test it.I try it using this,</p>
  
  <pre><code>@Test(expectedExceptions = { IllegalArgumentException.class })
    public void testMapOmResultStatusToNovaResultStatus_whenHaveDefaultValue_thenThrowIllegalArgumentException()
    {
      se.api.InvestigationResultStatus investigationResultStatusNewEnum = mock(se.api.InvestigationResultStatus.class);
      Whitebox.setInternalState(investigationResultStatusNewEnum, "name", "DEFAULT");
      Whitebox.setInternalState(investigationResultStatusNewEnum, "ordinal", "DefaultResult.rr");
  
      se.api.InvestigationResultStatus investigationResultStatusCosmic = mock(se.api.InvestigationResultStatus.class);
  
      when(investigationResultStatusCosmic.values()).thenReturn(
          new se.api.InvestigationResultStatus[] { InvestigationResultStatus.PENDING, InvestigationResultStatus.NEW,
              se.api.InvestigationResultStatus.MODIFIED, InvestigationResultStatus.FINAL, InvestigationResultStatus.PRELIMINARY,
              se.api.InvestigationResultStatus.ADDITIONAL, InvestigationResultStatus.REJECTED,
              se.api.InvestigationResultStatus.COMPLETE, InvestigationResultStatus.UNDEFINED, investigationResultStatusNewEnum });
  
      investigationResultStatusMapper.mapOmResultStatusToNovaResultStatus(investigationResultStatusNewEnum);
    }
  </code></pre>