Skip to content

Commit 556fb17

Browse files
committed
Added test for listing verifications and fixed bug
1 parent eb04554 commit 556fb17

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/main/java/com/blockscore/models/results/Verification.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.blockscore.common.ValidityStatus;
44
import com.blockscore.models.Details;
55
import com.blockscore.models.Person;
6-
import com.blockscore.models.QuestionSet;
76
import com.fasterxml.jackson.annotation.JsonProperty;
87
import org.jetbrains.annotations.NotNull;
98

@@ -24,7 +23,7 @@ public class Verification extends Person {
2423

2524
@NotNull
2625
@JsonProperty("question_sets")
27-
private List<QuestionSet> mQuestionSets;
26+
private List<String> mQuestionSets;
2827

2928
/**
3029
* Returns either valid or invalid and is the culmination of whether or not the passed
@@ -45,11 +44,11 @@ public Details getDetails() {
4544
}
4645

4746
/**
48-
* Gets the question sets associated with this verification record.
47+
* Gets the question set ids associated with this verification record.
4948
* @return Question sets.
5049
*/
5150
@NotNull
52-
public List<QuestionSet> getQuestionSets() {
51+
public List<String> getQuestionSets() {
5352
return mQuestionSets;
5453
}
5554
}

src/test/java/VerificationTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public void verificationTest() throws ParseException {
3434
verification = apiClient.getVerification(verification.getId()).toBlocking().first();
3535
isVerificationValid(verification);
3636

37+
//Test listing verifications
38+
List<Verification> verifications = apiClient.listVerificationsSync();
39+
areVerificationsValid(verifications);
40+
3741
//Test creation of a question set.
3842
QuestionSetRequest questionSetRequest = new QuestionSetRequest();
3943
questionSetRequest.setTimeLimit(100000).setVerificationId(verification.getId());
@@ -244,6 +248,17 @@ private Person createBadTestPerson() throws ParseException {
244248
return person;
245249
}
246250

251+
/**
252+
* Checks for a valid verification list.
253+
* @param verificationList Verifications under test.
254+
*/
255+
private void areVerificationsValid(@Nullable final List<Verification> verificationList) {
256+
Assert.assertNotNull(verificationList);
257+
for (Verification verification : verificationList) {
258+
isVerificationValid(verification);
259+
}
260+
}
261+
247262
/**
248263
* Determines if the verification is valid.
249264
* @param verification Verification under test.
@@ -252,9 +267,9 @@ private void isVerificationValid(@NotNull final Verification verification) {
252267
Assert.assertNotNull(verification);
253268
Assert.assertNotNull(verification.getId());
254269
Assert.assertNotNull(verification.getDateOfBirth());
270+
Assert.assertNotNull(verification.getQuestionSets());
255271

256272
areDetailsValid(verification.getDetails());
257-
areQuestionSetsValid(verification.getQuestionSets());
258273
isIdentificationValid(verification.getIdentification());
259274
isNameValid(verification.getName());
260275
isAddressValid(verification.getAddress());

0 commit comments

Comments
 (0)