Minor: CallSubject.hasHttpStatus() throws unchecked CallFailedRuntimeException

This commit is contained in:
Michael Vorburger
2020-10-24 23:36:03 +02:00
committed by Aleksandar Vidakovic
parent 43ef6e1983
commit 420d26a679
4 changed files with 16 additions and 13 deletions
@@ -21,8 +21,8 @@ package org.apache.fineract.client.testutil;
import com.google.common.truth.FailureMetadata;
import com.google.common.truth.Subject;
import com.google.common.truth.Truth;
import java.io.IOException;
import javax.annotation.Nullable;
import org.apache.fineract.client.util.Calls;
import retrofit2.Call;
/**
@@ -49,7 +49,7 @@ public class CallSubject extends Subject {
this.actual = actual;
}
public void hasHttpStatus(int expectedHttpStatus) throws IOException {
check("httpStatus").that(actual.execute().code()).isEqualTo(expectedHttpStatus);
public void hasHttpStatus(int expectedHttpStatus) {
check("httpStatus").that(Calls.executeU(actual).code()).isEqualTo(expectedHttpStatus);
}
}
@@ -43,7 +43,7 @@ public class DocumentTest extends IntegrationTest {
@Test
@Order(1)
void retrieveAllDocuments() throws IOException {
void retrieveAllDocuments() {
assertThat(ok(fineract().documents.retrieveAllDocuments("clients", clientId))).isNotNull();
}
@@ -100,14 +100,14 @@ public class DocumentTest extends IntegrationTest {
@Test
@Order(99)
void deleteDocument() throws IOException {
void deleteDocument() {
ok(fineract().documents.deleteDocument("clients", clientId, documentId));
assertThat(fineract().documents.getDocument("clients", clientId, documentId)).hasHttpStatus(404);
}
@Order(9999)
@Test // FINERACT-1036
void createDocumentBadArgs() throws IOException {
void createDocumentBadArgs() {
assertThat(fineract().documents.createDocument("clients", 123L, null, "test.pdf", null)).hasHttpStatus(400);
}
}