io.rxmicro.test.mockito.httpclient.internal.AbstractHttpRequestMock Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxmicro-test-mockito Show documentation
Show all versions of rxmicro-test-mockito Show documentation
The module designed for test writing using the Mockito framework.
/*
* Copyright (c) 2020. https://rxmicro.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.rxmicro.test.mockito.httpclient.internal;
import io.rxmicro.http.HttpHeaders;
import io.rxmicro.http.QueryParams;
import io.rxmicro.rest.model.HttpMethod;
import java.util.Optional;
/**
* @author nedis
* @since 0.1
*/
public abstract class AbstractHttpRequestMock {
protected static final Object EMPTY_BODY = new Object();
private final HttpMethod method;
private final String path;
private final HttpHeaders headers;
private final QueryParams queryParameters;
private final Object body;
private final boolean any;
protected AbstractHttpRequestMock(final HttpMethod method,
final String path,
final HttpHeaders headers,
final QueryParams queryParameters,
final Object body,
final boolean any) {
this.method = method;
this.path = path;
this.headers = headers;
this.queryParameters = queryParameters;
this.body = body;
this.any = any;
}
protected Optional getMethod() {
return Optional.ofNullable(method);
}
protected Optional getPath() {
return Optional.ofNullable(path);
}
protected Optional getHeaders() {
return Optional.ofNullable(headers);
}
protected Optional getQueryParameters() {
return Optional.ofNullable(queryParameters);
}
protected Optional