
com.aventstack.chaintest.http.WrappedResponseAsync Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chaintest-core Show documentation
Show all versions of chaintest-core Show documentation
Core Java client library for ChainTest framework
The newest version!
package com.aventstack.chaintest.http;
import com.aventstack.chaintest.domain.ChainTestEntity;
import lombok.Getter;
import java.net.http.HttpResponse;
import java.util.concurrent.CompletableFuture;
@Getter
public class WrappedResponseAsync extends WrappedResponse {
private CompletableFuture> responseFuture;
public WrappedResponseAsync(final T entity, final CompletableFuture> response) {
super(entity);
this.responseFuture = response;
}
public WrappedResponseAsync(final T entity) {
super(entity);
}
public WrappedResponseAsync(final ErrorResponse error) {
super(error);
}
public void setResponseFuture(CompletableFuture> responseFuture) {
responseFuture.whenComplete((res, e) -> {
if (null != e) {
setError(new ErrorResponse(e));
} else {
setResponse(res);
}
});
this.responseFuture = responseFuture;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
WrappedResponseAsync> that = (WrappedResponseAsync>) obj;
return responseFuture.equals(that.responseFuture);
}
@Override
public int hashCode() {
return responseFuture.hashCode();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy