All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jio.test.pbt.Context Maven / Gradle / Ivy

Go to download

JIO test library based on Property Based Testing and Java Flight Recording Debuggers

There is a newer version: 3.0.0-RC2
Show newest version
package jio.test.pbt;

import jsonvalues.*;

import java.time.Instant;

/**
 * Represents information related to a specific test execution.
 *
 * @param start              The instant when a test starts.
 * @param seed               The seed for random data generation.
 * @param generatedSeqNumber The sequence number for data generation.
 * @param input              The input data of the test.
 */
record Context(Instant start,
               long seed,
               int generatedSeqNumber,
               Object input,
               String tags
) {

  /**
   * Serializes this record into a JSON object, converting the input data into a string with its toString method. The
   * JSON schema is as follows:
   *
   * 
   *     {@code
   *     {
   *         "start": instant,
   *         "seed": long,
   *         "seq_number": int,
   *         "input": string,
   *         "tags": string
   *     }
   *     }
   * 
* * @return A JSON representation of the test context. */ public JsObj toJson() { return JsObj.of("start", JsInstant.of(start), "seed", JsLong.of(seed), "seq_number", JsInt.of(generatedSeqNumber), "input", JsStr.of(input.toString()), "tags", JsStr.of(tags) ); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy