Class LiteralFileReader


  • public class LiteralFileReader
    extends Object
    Method parse(java.lang.String) reads a file specifying literal values to use during generation. The text file should contain one or more records of the form:
     START CLASSLITERALS
     CLASSNAME
     classname
     LITERALS
     type:value
     ...
     type:value
     END CLASSLITERALS
     
    Capitalized text must appear literally. Lowercase text is as follows:
    • classname is the name of a class in Class.getName format. More specifically, TypeNames.getTypeForName(classname) must return a valid Class object.
    • Each type:value pair describes the type and value of a literal (for example, int:3).
    Blank lines and comment lines (lines starting with "#") are ignored, both between records and inside records.

    An example literals file appears in file randoop/systemTests/resources/literalsfile.txt.

    LIMITATIONS:

    Error messages do not include line numbers pointing to location of the error. There is no way to specify literals that are not related to any class in particular, or literals that are related to only specific methods within a class.

    • Constructor Detail

      • LiteralFileReader

        private LiteralFileReader()
    • Method Detail

      • parse

        public static MultiMap<ClassOrInterfaceType,​Sequence> parse​(String inFile)
        Returns a map from class to list of constants.
        Parameters:
        inFile - the input file
        Returns:
        the map from types to literal values
      • throwRecordSyntaxError

        private static void throwRecordSyntaxError​(Throwable e)
        Throw an error with the given exception as its cause.
        Parameters:
        e - the cause
      • throwRecordSyntaxError

        private static void throwRecordSyntaxError​(String string,
                                                   List<String> lines,
                                                   int i)