title: JUnit @Test InvalidStateException
body: <p>I'm having a problem with my test application which is follows. I'm having following code:</p>
  
  <pre><code>@Test(expected = InvalidStateException.class)
  public void testLiianPitkaKayttajatunnus()
  </code></pre>
  
  <p>{...}</p>
  
  <p>I'm using Eclipse and it says <code>"InvalidStateException cannot be resolved to a type"</code> and as we know if eclipse notice a problem it underline it with red wave line. I have been trying to search solutions but still not found any. I have tried following things but none of them has solved the problem:</p>
  
  <ol>
  <li>Adding <code>org.apache.openjpa</code> dependency to my <code>pom.xml</code> and adding line before class code <code>"import org.apache.openjpa.persistence.InvalidStateException;"</code></li>
  <li>In <a href="https://stackoverflow.com/questions/1151237/junit-expected-tag-not-working-as-expected">thread</a>, it is said that if you have in your class extension of other class, it should be taken out. This didn't helped neither.</li>
  <li>In the same thread one advice is to use JUnit 4.4 and it didn't helped neither.</li>
  </ol>
  
  <p>So my question is how this problem can be solved?</p>
  
  <p>For additional information, my class start follows (imports are not mentioned here)
  public class <code>TietorakenneTest</code> extends <code>TietokantaTestCase {....}</code> and JUnit version that I use is 4.10,
  any help is appreciated. If you need any other information about the code, please let me know and I will put them here.</p>