title: How to test a constructor will throw an illegal state exception?
body: <p>I have a utility class with a private constructor that throws an Illegal state exception and I want to test that it does this.</p>
  
  <p>I've tried a test where I implement the constructor, but since the constructor is private it can't be accessed outside of the class. So is it just pointless to test the constructor?</p>
  
  <p>from the class</p>
  
  <pre><code> private UtilityClass(){
          throw new IllegalStateException("Utility Class");
      }
  </code></pre>
  
  <p>from the test class</p>
  
  <pre><code>private UtilityClass = utilityClass;
      @Test(expected = IllegalStateException.class)
      public void constructorTest(){
          utilityClass = new UtilityClass();
      }
  </code></pre>