I have the following code
//Unit to be tested (classname : PropertiesFile)
public static String getProperty(String name) {
return propertiesMap.get(name).toString();
}
where propertiesMap is a normal hashmap defined as Map propertiesMap;
Here is my TestNG test :
@Test()
public void testGetProperty1(@Mocked final Map<String, String> propertiesMap)
{
new NonStrictExpectations()
{{
propertiesMap.get("region");
result = anyString;
}};
PropertiesFile.getProperty("region");
}
I am getting NPE on return line.
Please let me know what I am doing wrong here? and how to get rid of this NPE and make the test work properly.
Aucun commentaire:
Enregistrer un commentaire