Class TestValueExtractor

  • All Implemented Interfaces:
    ClassVisitor

    public class TestValueExtractor
    extends DefaultClassVisitor
    TestValueExtractor is a ClassVisitor that inspects the fields passed to it to see if they are annotated with TestValue, are static, and have type that is primitive, String, or an array of primitive or String.
    • Field Detail

      • valueSequences

        private final Set<Sequence> valueSequences
    • Constructor Detail

      • TestValueExtractor

        public TestValueExtractor​(Set<Sequence> valueSequences)
    • Method Detail

      • visit

        public void visit​(Field f)
        Perform an action on a field.

        If the field is static and is annotated with randoop.TestValue, adds the value of the field to the sequence set constructed by this visitor. Requires that the field type be primitive, String, or an array of primitive or String type.

        Specified by:
        visit in interface ClassVisitor
        Overrides:
        visit in class DefaultClassVisitor
        Parameters:
        f - the field
      • getValue

        private List<Object> getValue​(Field f)
        Returns the value stored in the given (static) field with primitive, String or array of primitive or String type.
        Parameters:
        f - the field
        Returns:
        the value(s) in the field
      • printDetectedAnnotatedFieldMsg

        private static void printDetectedAnnotatedFieldMsg​(Field f)
        Prints an informational message that an annotated field has been found.
        Parameters:
        f - the field