Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate toJson functionality #131

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/test/java/com/onfido/integration/AddressTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ public void pickTest() throws Exception {
Assertions.assertNotNull(addresses);
Assertions.assertEquals("S2 2DF", addresses.get(0).getPostcode());
Assertions.assertEquals("S2 2DF", addresses.get(1).getPostcode());

Assertions.assertNotNull(addresses.get(0).toJson());
}
}
9 changes: 9 additions & 0 deletions src/test/java/com/onfido/integration/ApplicantTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public void createApplicantTest() throws Exception {

Assertions.assertEquals("First", applicant.getFirstName());
Assertions.assertEquals("Last", applicant.getLastName());

Assertions.assertNotNull(applicant.toJson());
}

@Test
Expand All @@ -38,6 +40,8 @@ public void findApplicantTest() throws Exception {

Assertions.assertEquals("First", lookupApplicant.getFirstName());
Assertions.assertEquals("Last", lookupApplicant.getLastName());

Assertions.assertNotNull(lookupApplicant.toJson());
}

@Test
Expand All @@ -47,6 +51,8 @@ public void updateApplicantTest() throws Exception {

Assertions.assertEquals("Updated", updatedApplicant.getFirstName());
Assertions.assertEquals("Last", updatedApplicant.getLastName());

Assertions.assertNotNull(updatedApplicant.toJson());
}

@Test
Expand Down Expand Up @@ -76,5 +82,8 @@ public void listApplicants() throws Exception {

Assertions.assertEquals("Applicant1", applicants.get(0).getFirstName());
Assertions.assertEquals("Applicant2", applicants.get(1).getFirstName());

Assertions.assertNotNull(applicants.get(0).toJson());
Assertions.assertNotNull(applicants.get(1).toJson());
}
}
6 changes: 6 additions & 0 deletions src/test/java/com/onfido/integration/CheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public void createCheckTest() throws Exception {

Assertions.assertEquals(applicant.getId(), check.getApplicantId());
Assertions.assertEquals(null, check.getWebhookIds());

Assertions.assertNotNull(check.toJson());
}

@Test
Expand Down Expand Up @@ -85,6 +87,8 @@ public void findCheckTest() throws Exception {
Check lookupCheck = onfido.findCheck(check.getId());

Assertions.assertEquals(check.getApplicantId(), lookupCheck.getApplicantId());

Assertions.assertNotNull(check.toJson());
}

@Test
Expand All @@ -96,6 +100,8 @@ public void listChecks() throws Exception {

Assertions.assertEquals(applicant.getId(), checks.get(0).getApplicantId());
Assertions.assertEquals(1, checks.size());

Assertions.assertNotNull(checks.get(0).toJson());
}

@Test
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/onfido/integration/DocumentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public void setupTest() throws Exception {
@Test
public void uploadDocumentTest() throws Exception {
Assertions.assertEquals("sample_driving_licence.png", document.getFileName());

Assertions.assertNotNull(document.toJson());
}

@Test
Expand All @@ -51,6 +53,7 @@ public void findDocumentTest() throws Exception {
Document lookupDocument = onfido.findDocument(document.getId());

Assertions.assertEquals("sample_driving_licence.png", lookupDocument.getFileName());
Assertions.assertNotNull(lookupDocument.toJson());
}

@Test
Expand All @@ -66,6 +69,9 @@ public void listDocumentsTest() throws Exception {
Assertions.assertEquals(FileTypeEnum.JPEG, documents.get(0).getFileType());
Assertions.assertEquals("sample_driving_licence.png", documents.get(1).getFileName());
Assertions.assertEquals(FileTypeEnum.PNG, documents.get(1).getFileType());

Assertions.assertNotNull(documents.get(0).toJson());
Assertions.assertNotNull(documents.get(1).toJson());
}

@Test
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/onfido/integration/ExtractionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ public void performExtractionTest() throws Exception {
Assertions.assertEquals("SARAH", extractedData.getFirstName());
Assertions.assertEquals("MORGAN", extractedData.getLastName());
Assertions.assertEquals(GenderEnum.FEMALE, extractedData.getGender());

Assertions.assertNotNull(extraction.toJson());
Assertions.assertNotNull(documentClassification.toJson());
Assertions.assertNotNull(extractedData.toJson());
}
}
7 changes: 7 additions & 0 deletions src/test/java/com/onfido/integration/IdPhotoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public void setupTest() throws Exception {
@Test
public void uploadIdPhotoTest() throws Exception {
Assertions.assertEquals(idPhoto.getId() + ".png", idPhoto.getFileName());

Assertions.assertNotNull(idPhoto.toJson());
}

@Test
Expand All @@ -51,6 +53,8 @@ public void findIdPhotoTest() throws Exception {
IdPhoto lookupIdPhoto = onfido.findIdPhoto(idPhoto.getId());

Assertions.assertEquals(idPhoto.getId() + ".png", lookupIdPhoto.getFileName());

Assertions.assertNotNull(idPhoto.toJson());
}

@Test
Expand All @@ -64,5 +68,8 @@ public void listIdPhotosTest() throws Exception {

Assertions.assertEquals(idPhotos.get(0).getId() + ".png", idPhotos.get(0).getFileName());
Assertions.assertEquals(idPhotos.get(1).getId() + ".png", idPhotos.get(1).getFileName());

Assertions.assertNotNull(idPhotos.get(0).toJson());
Assertions.assertNotNull(idPhotos.get(1).toJson());
}
}
7 changes: 7 additions & 0 deletions src/test/java/com/onfido/integration/LivePhotoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public void setupTest() throws Exception {
@Test
public void uploadLivePhotoTest() throws Exception {
Assertions.assertEquals("sample_photo.png", livePhoto.getFileName());

Assertions.assertNotNull(livePhoto.toJson());
}

@Test
Expand All @@ -51,6 +53,8 @@ public void findLivePhotoTest() throws Exception {
LivePhoto lookupLivePhoto = onfido.findLivePhoto(livePhoto.getId());

Assertions.assertEquals("sample_photo.png", lookupLivePhoto.getFileName());

Assertions.assertNotNull(lookupLivePhoto.toJson());
}

@Test
Expand All @@ -64,5 +68,8 @@ public void listLivePhotosTest() throws Exception {

Assertions.assertEquals("another_sample_photo.png", livePhotos.get(0).getFileName());
Assertions.assertEquals("sample_photo.png", livePhotos.get(1).getFileName());

Assertions.assertNotNull(livePhotos.get(0).toJson());
Assertions.assertNotNull(livePhotos.get(1).toJson());
}
}
5 changes: 5 additions & 0 deletions src/test/java/com/onfido/integration/LiveVideoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void findLiveVideoTest() throws Exception {
LiveVideo liveVideo = onfido.findLiveVideo(sampleLiveVideoId1);

Assertions.assertEquals("video.mov", liveVideo.getFileName());

Assertions.assertNotNull(liveVideo.toJson());
}

@Test
Expand All @@ -60,5 +62,8 @@ public void listLiveVideosTest() throws Exception {

Assertions.assertEquals("video.mov", liveVideos.get(0).getFileName());
Assertions.assertEquals("video.mov", liveVideos.get(1).getFileName());

Assertions.assertNotNull(liveVideos.get(0).toJson());
Assertions.assertNotNull(liveVideos.get(1).toJson());
}
}
5 changes: 5 additions & 0 deletions src/test/java/com/onfido/integration/MotionCaptureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public void findMotionCaptureTest() throws Exception {
MotionCapture motionCapture = onfido.findMotionCapture(EXAMPLE_ID_1);

Assertions.assertEquals(expectedFilename, motionCapture.getFileName());

Assertions.assertNotNull(motionCapture.toJson());
}

@Test
Expand All @@ -65,5 +67,8 @@ public void listMotionCapturesTest() throws Exception {
onfido.listMotionCaptures(sampleApplicantId).getMotionCaptures();

Assertions.assertEquals(2, motionCaptures.size());

Assertions.assertNotNull(motionCaptures.get(0).toJson());
Assertions.assertNotNull(motionCaptures.get(1).toJson());
}
}
12 changes: 12 additions & 0 deletions src/test/java/com/onfido/integration/ReportSchemasTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public void schemaOfDocumentReportIsValid() throws Exception {
Assertions.assertNotNull(documentReport.getDocumentReport().getBreakdown());
Assertions.assertNotNull(documentReport.getDocumentReport().getProperties());
Assertions.assertNull(documentReport.getDocumentReport().getProperties().getDocumentSubtype());

Assertions.assertNotNull(documentReport.getDocumentReport().toJson());
Assertions.assertNotNull(documentReport.getDocumentReport().getBreakdown().toJson());
Assertions.assertNotNull(documentReport.getDocumentReport().getProperties().toJson());
}

@Test
Expand Down Expand Up @@ -89,5 +93,13 @@ public void schemaOfFacialSimilarityPhotoReportIsValid() throws Exception {
facialSimilarityPhotoFullyAutoReport
.getFacialSimilarityPhotoFullyAutoReport()
.getProperties());

Assertions.assertNotNull(
facialSimilarityPhotoFullyAutoReport.getFacialSimilarityPhotoFullyAutoReport().toJson());
Assertions.assertNotNull(
facialSimilarityPhotoFullyAutoReport
.getFacialSimilarityPhotoFullyAutoReport()
.getProperties()
.toJson());
}
}
2 changes: 2 additions & 0 deletions src/test/java/com/onfido/integration/SdkTokenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public void generateTokenTest() throws Exception {
.referrer("https://*.example.com/example_page/*"));

Assertions.assertTrue(token.getToken().length() > 0);

Assertions.assertNotNull(token.toJson());
}
}
5 changes: 5 additions & 0 deletions src/test/java/com/onfido/integration/TasksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public void listTasks() throws Exception {
List<TaskItem> tasks = onfido.listTasks(workflowRunId);

Assertions.assertEquals(2, tasks.size());

Assertions.assertNotNull(tasks.get(0).toJson());
Assertions.assertNotNull(tasks.get(1).toJson());
}

@Test
Expand All @@ -39,6 +42,8 @@ public void findTask() throws Exception {

Assertions.assertEquals(lookupTask.getId(), task.getId());
Assertions.assertEquals(lookupTask.getTaskDefId(), task.getTaskDefId());

Assertions.assertNotNull(task.toJson());
}

@Test
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/com/onfido/integration/WebhookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ private Webhook createWebhook(String url) throws Exception {
@Test
public void createWebhookTest() throws Exception {
Assertions.assertEquals("https://example.com/webhook", webhook.getUrl());

Assertions.assertNotNull(webhook.toJson());
}

@Test
public void findWebhookTest() throws Exception {
Webhook lookupWebhook = onfido.findWebhook(webhook.getId());

Assertions.assertEquals("https://example.com/webhook", lookupWebhook.getUrl());

Assertions.assertNotNull(lookupWebhook.toJson());
}

@Test
Expand All @@ -52,6 +56,8 @@ public void updateWebhookTest() throws Exception {
webhook.getId(), new WebhookUpdater().url("https://example.com/webhook/updated"));

Assertions.assertEquals("https://example.com/webhook/updated", updatedWebhook.getUrl());

Assertions.assertNotNull(updatedWebhook.toJson());
}

@Test
Expand All @@ -72,6 +78,9 @@ public void listWebhooksTest() throws Exception {
Assertions.assertEquals(3, webhooks.size());
Assertions.assertEquals("https://example.com/firstWebhook", webhooks.get(0).getUrl());
Assertions.assertEquals("https://example.com/secondWebhook", webhooks.get(1).getUrl());

Assertions.assertNotNull(webhooks.get(0).toJson());
Assertions.assertNotNull(webhooks.get(1).toJson());
}

@Test
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/com/onfido/integration/WorkflowRunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public void setup() throws Exception {
public void createWorkflowRunTest() throws Exception {
Assertions.assertEquals(WORKFLOW_ID, workflowRun.getWorkflowId());
Assertions.assertEquals(applicantId, workflowRun.getApplicantId());

Assertions.assertNotNull(workflowRun.toJson());
}

@Test
Expand All @@ -50,6 +52,8 @@ public void createWorkflowRunWithCustomInputsTest() throws Exception {
Assertions.assertEquals(applicantId, workflowRunWithCustomInputs.getApplicantId());
Assertions.assertEquals(
WorkflowRun.StatusEnum.APPROVED, workflowRunWithCustomInputs.getStatus());

Assertions.assertNotNull(workflowRunWithCustomInputs.toJson());
}

@Test
Expand All @@ -58,6 +62,8 @@ public void findWorkflowRunTest() throws Exception {

Assertions.assertEquals(WORKFLOW_ID, lookupWorkflowRun.getWorkflowId());
Assertions.assertEquals(applicantId, lookupWorkflowRun.getApplicantId());

Assertions.assertNotNull(lookupWorkflowRun.toJson());
}

@Test
Expand All @@ -78,6 +84,8 @@ public void generateTimelineFileTest() throws Exception {

Assertions.assertNotNull(workflowTimelineFileData.getWorkflowTimelineFileId());
Assertions.assertNotNull(workflowTimelineFileData.getHref());

Assertions.assertNotNull(workflowTimelineFileData.toJson());
}

@Test
Expand Down
Loading