package be.fgov.ehealth.technicalconnector.tests.server.callback;

import be.fgov.ehealth.technicalconnector.tests.server.asserter.HttpAsserter;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;

public class AssertExpectationCallback extends AbstractExpectationCallback {

    public HttpAsserter asserter;

    public AssertExpectationCallback(HttpAsserter asserter) {
        this.asserter = asserter;
    }

    @Override
    public HttpResponse handle(HttpRequest httpRequest) {
        try {
            return asserter.assertSession(httpRequest);
        } catch (Exception e) {
            return internalError(e.getMessage(), e);
        }
    }
}
