Home | History | Annotate | Download | only in junitparams
      1 package junitparams;
      2 
      3 import static org.assertj.core.api.Assertions.assertThat;
      4 
      5 import org.junit.Test;
      6 import org.junit.runner.RunWith;
      7 
      8 @RunWith(JUnitParamsRunner.class)
      9 public class InstantiatingTestClassOnceTest {
     10 
     11     private static final int NUMBER_OF_TEST_METHODS_IN_THIS_CLASS = 1;
     12     private static int instantiationsCount = 0;
     13 
     14     @Test
     15     public void shouldBeInstantiatedOncePerTestMethod() {
     16         assertThat(instantiationsCount).isEqualTo(NUMBER_OF_TEST_METHODS_IN_THIS_CLASS);
     17     }
     18 
     19     public InstantiatingTestClassOnceTest() {
     20         instantiationsCount++;
     21     }
     22 
     23 }