Class FieldMatcher

java.lang.Object
kong.unirest.core.FieldMatcher
All Implemented Interfaces:
BodyMatcher

public class FieldMatcher extends Object implements BodyMatcher
Matches simple form fields
  • Constructor Details

    • FieldMatcher

      public FieldMatcher(Map<String,String> formParams)
      Creates a FieldMatcher expecting a map of keys and values
      Parameters:
      formParams - the map of field params
  • Method Details

    • of

      public static FieldMatcher of(String... keyValuePairs)
      Creates a FieldMatcher expecting a map of keys and values use like: FieldMatcher.of("fruit", "orange", "quantity" "42")
      Parameters:
      keyValuePairs - an array of key-value pairs to expect
      Returns:
      a new FieldMatcher
    • matches

      public MatchStatus matches(List<String> body) throws AssertionError
      Description copied from interface: BodyMatcher
      indicates if the Matcher succeeded in matching the body
      Specified by:
      matches in interface BodyMatcher
      Parameters:
      body - the list of body parts
      Returns:
      MatchStatus indicating if the Matcher succeeded in matching the body
      Throws:
      AssertionError