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

com.browserup.bup.assertion.ResponseTimeWithinHarEntryAssertion Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
/*
 * Modifications Copyright (c) 2019 BrowserUp, Inc.
 */

package com.browserup.bup.assertion;

import com.browserup.bup.assertion.error.HarEntryAssertionError;
import com.browserup.harreader.model.HarEntry;

import java.util.Optional;

public class ResponseTimeWithinHarEntryAssertion implements HarEntryAssertion {
    private final Long time;

    public ResponseTimeWithinHarEntryAssertion(Long time) {
        this.time = time;
    }

    @Override
    public Optional assertion(HarEntry entry) {
        if (entry.getTime() > time) {
            return Optional.of(new HarEntryAssertionError("Time exceeded", time, entry.getTime()));
        }
        return Optional.empty();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy