Here is my class
package com.myCompany.test;
// imports
@Test
public class Test{
private static final Map<Type, String> depMap;
static {
depMap = new HashMap<>();
depMap.put(Type.ONE, "1234");
}
@Test(groups="small")
public void testOne(){
// something
String typeOneVal = depMap.get(Type.ONE); // NullPointerException
// assertions
}
}
The test suite looks like below:
<test name="Small Test Set">
<groups>
<run>
<exclude name="brokenTests" />
<include name="small" />
</run>
</groups>
<packages>
<package name="com.myCompany.test.*" />
</packages>
</test>
How can depMap
ever be null
when this TestNG class is executed by method, class, suite etc? It runs on my local fine but fails in CI job, both executing the test suite. Pretty confused now!