com.github.tomakehurst.wiremock.common.Timing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wiremock-jre8-standalone Show documentation
Show all versions of wiremock-jre8-standalone Show documentation
A web service test double for all occasions - standalone edition
package com.github.tomakehurst.wiremock.common;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Timing {
public static final Timing UNTIMED = new Timing(-1, -1);
private final int addedDelay;
private final int processTime;
private final int responseSendTime;
public Timing(int addedDelay, int processTime) {
this(addedDelay, processTime, -1, -1, -1);
}
private Timing(@JsonProperty("addedDelay") int addedDelay,
@JsonProperty("processTime") int processTime,
@JsonProperty("responseSendTime") int responseSendTime,
@JsonProperty("serveTime") int ignored1,
@JsonProperty("totalTime") int ignored2
) {
this.addedDelay = addedDelay;
this.processTime = processTime;
this.responseSendTime = responseSendTime;
}
/**
* The delay added to the response via the stub or global configuration
*/
public int getAddedDelay() {
return addedDelay;
}
/**
* The amount of time spent handling the stub request
*/
public int getProcessTime() {
return processTime;
}
/**
* The amount of time taken to send the response to the client
*/
public int getResponseSendTime() {
return responseSendTime;
}
/**
* The total request time from start to finish, minus added delay
*/
public int getServeTime() {
return processTime + responseSendTime;
}
/**
* The total request time including added delay
*/
public int getTotalTime() {
return getServeTime() + addedDelay;
}
public Timing withResponseSendTime(int responseSendTimeMillis) {
return new Timing(addedDelay, processTime, responseSendTimeMillis, -1, -1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy