Lookup table files

While property files can be used to store environment data, they can also be used to store confirmation and error messages. Users can retrieve the error messages using a code that development provides, in essence creating a lookup table. Here is a Java utility method for reading and converting error messages on the fly for use in negative testing:

# Exception Messages
001=Invalid Login, please try again
002=Login failed, user not found
003=Password is not valid
etc...

/**
* lookupError - method to retrieve error messages using code
*
* @param propFilePath - the property file including path to read
* @param code - the error code to use
* @return String
* @throws Exception
*/
public static String lookupError(String propFilePath,
String code)
throws Exception {

Properties exceptionProps = new Properties();
exceptionProps.load(new FileInputStream(propFilePath));

// get error message using code as key
return exceptionProps.getProperty(code);
}