When I run my @Tests manualy, one by one - everything is fine. But when I run them all together - I`ve got an error. So how can I run @BeforeClass before each @Test. I cant use @Before becorse in my @BeforeClass I do some work in testing class constructor.
Testing class constructor:
public HttpUtils() {
this.httpClient = HttpClients.createDefault();
}
Before class:
@BeforeClass
public static void init() throws IOException {
mockStatic(HttpClients.class);
final CloseableHttpClient closeableHttpClient = createMock(CloseableHttpClient.class);
when(HttpClients.createDefault()).thenReturn(closeableHttpClient);
}
If I run all test. On second test Ive got HttpClient not like mock, but like real object, and lately have error coz of it.