Share via


RecordedData Class

  • java.lang.Object
    • com.azure.core.test.models.RecordedData

Implements

public class RecordedData
implements JsonSerializable<RecordedData>

Keeps track of the network calls and variable names that were made in a test session.

Constructor Summary

Constructor Description
RecordedData()

Creates a new instance of RecordedData to manage network calls and variables in a test session.

Method Summary

Modifier and Type Method and Description
void addNetworkCall(NetworkCallRecord record)

Adds a network call to the end of the list.

void addVariable(String variable)

Adds a variable to the end of the list.

NetworkCallRecord findFirstAndRemoveNetworkCall(Predicate<NetworkCallRecord> isMatch)

Finds the first matching NetworkCallRecord based on the predicate, removes it from the current network calls, and returns it.

static RecordedData fromJson(JsonReader jsonReader)

Deserializes an instance of RecordedData from the input JSON.

String removeVariable()

Removes the first variable from the list and returns it.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

RecordedData

public RecordedData()

Creates a new instance of RecordedData to manage network calls and variables in a test session.

Method Details

addNetworkCall

public void addNetworkCall(NetworkCallRecord record)

Adds a network call to the end of the list.

Parameters:

record - The record to add.

addVariable

public void addVariable(String variable)

Adds a variable to the end of the list.

Parameters:

variable - The variable to add to the list.

findFirstAndRemoveNetworkCall

public NetworkCallRecord findFirstAndRemoveNetworkCall(Predicate<NetworkCallRecord> isMatch)

Finds the first matching NetworkCallRecord based on the predicate, removes it from the current network calls, and returns it. null is returned if network call could not be matched.

Parameters:

isMatch - Predicate to match for a given network call.

Returns:

The first NetworkCallRecord that matched isMatch, otherwise null if no network call could be matched.

fromJson

public static RecordedData fromJson(JsonReader jsonReader)

Deserializes an instance of RecordedData from the input JSON.

Parameters:

jsonReader - The JSON reader to deserialize the data from.

Returns:

An instance of RecordedData deserialized from the JSON.

Throws:

IOException

- If the JSON reader encounters an error while reading the JSON.

removeVariable

public String removeVariable()

Removes the first variable from the list and returns it.

Returns:

The first variable.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to