Class TestRestTemplate

java.lang.Object
com.codename1.backend.test.TestRestTemplate

public final class TestRestTemplate extends Object

An HTTP client for a BackendTest served on a port -- webEnvironment = RANDOM_PORT -- through the backend's own outbound client, so a compiled test sends real requests from the native binary too.

A path is relative to the server; an absolute URL is sent as it is. A 4xx or 5xx is a response to assert on, not an exception. Bodies convert to and from String, byte[], and Map or List as JSON.

The Java SE client behind cn1:backend cannot send PATCH (its HTTP client has a fixed set of verbs); use MockMvc for a PATCH route, or a compiled run.