Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class MockMvcResultMatchers

  1. Object
  2. MockMvcResultMatchers

The expectations andExpect(...) takes, for static import:

mvc.perform(get("/pets/7"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.name").value("Rex"));

Methods

public static StatusResultMatchers status()
public static ContentResultMatchers content()
public static HeaderResultMatchers header()
public static CookieResultMatchers cookie()
public static JsonPathResultMatchers jsonPath(String expression, Object... args)A JSONPath into the JSON body: $.name, $.items[0].id, $.items[*].id, $['odd key'], $.items.length().
public static ResultMatcher redirectedUrl(String expected)The response redirects to exactly this location.

Inherited methods

Method details

status

public static StatusResultMatchers status()

content

public static ContentResultMatchers content()

header

public static HeaderResultMatchers header()

cookie

public static CookieResultMatchers cookie()

jsonPath

public static JsonPathResultMatchers jsonPath(String expression, Object... args)
A JSONPath into the JSON body: $.name, $.items[0].id, $.items[*].id, $['odd key'], $.items.length(). Each %s in the expression takes the next of args.

redirectedUrl

public static ResultMatcher redirectedUrl(String expected)
The response redirects to exactly this location.