-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a20eb6
commit 2eda751
Showing
5 changed files
with
384 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...nagement/src/test/java/org/egov/referralmanagement/helper/ReferralRequestTestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.egov.referralmanagement.helper; | ||
|
||
import org.egov.common.helper.RequestInfoTestBuilder; | ||
import org.egov.common.models.referralmanagement.ReferralRequest; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class ReferralRequestTestBuilder { | ||
private ReferralRequest.ReferralRequestBuilder builder; | ||
|
||
private ArrayList referral = new ArrayList(); | ||
|
||
public ReferralRequestTestBuilder() { | ||
this.builder = ReferralRequest.builder(); | ||
} | ||
|
||
public static ReferralRequestTestBuilder builder() { | ||
return new ReferralRequestTestBuilder(); | ||
} | ||
|
||
public ReferralRequest build() { | ||
return this.builder.build(); | ||
} | ||
|
||
public ReferralRequestTestBuilder withOneReferral() { | ||
builder.requestInfo(RequestInfoTestBuilder.builder().withCompleteRequestInfo().build()) | ||
.referral(ReferralTestBuilder.builder().withId().withAuditDetails().build()); | ||
return this; | ||
} | ||
|
||
public ReferralRequestTestBuilder withApiOperationNotNullAndNotCreate() { | ||
builder.requestInfo(RequestInfoTestBuilder.builder().withCompleteRequestInfo().build()) | ||
.referral(ReferralTestBuilder.builder().withIdNull().build()); | ||
return this; | ||
} | ||
|
||
public ReferralRequestTestBuilder withApiOperationNotUpdate() { | ||
builder.requestInfo(RequestInfoTestBuilder.builder().withCompleteRequestInfo().build()) | ||
.referral(ReferralTestBuilder.builder().withIdNull().build()); | ||
return this; | ||
} | ||
|
||
public ReferralRequestTestBuilder withOneReferralHavingId() { | ||
builder.requestInfo(RequestInfoTestBuilder.builder().withCompleteRequestInfo().build()) | ||
.referral(ReferralTestBuilder.builder().withId().withAuditDetails().build()); | ||
return this; | ||
} | ||
|
||
public ReferralRequestTestBuilder withBadTenantIdInOneReferral() { | ||
|
||
builder.requestInfo(RequestInfoTestBuilder.builder().withCompleteRequestInfo().build()) | ||
.referral(ReferralTestBuilder.builder().withIdNull().withBadTenantId().build()); | ||
return this; | ||
} | ||
|
||
public ReferralRequestTestBuilder withRequestInfo(){ | ||
this.builder.requestInfo(RequestInfoTestBuilder.builder().withCompleteRequestInfo().build()); | ||
return this; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...erralmanagement/src/test/java/org/egov/referralmanagement/helper/ReferralTestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.egov.referralmanagement.helper; | ||
|
||
import org.egov.common.helper.AuditDetailsTestBuilder; | ||
import org.egov.common.models.referralmanagement.Referral; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
public class ReferralTestBuilder { | ||
|
||
private Referral.ReferralBuilder builder; | ||
|
||
public ReferralTestBuilder() { | ||
this.builder = Referral.builder(); | ||
} | ||
|
||
public static ReferralTestBuilder builder() { | ||
return new ReferralTestBuilder(); | ||
} | ||
|
||
public Referral build() { | ||
return this.builder.hasErrors(false).build(); | ||
} | ||
|
||
public ReferralTestBuilder withIdNull() { | ||
this.builder.projectBeneficiaryId("some-projectBeneficiary-id") | ||
.clientReferenceId("ClientReferenceId") | ||
.id(null) | ||
.projectBeneficiaryClientReferenceId("projectBeneficiaryClientReferenceId") | ||
.reasons(new ArrayList<>(Arrays.asList("fever"))) | ||
.tenantId("some-tenant-id") | ||
.rowVersion(1); | ||
return this; | ||
} | ||
|
||
public ReferralTestBuilder withId() { | ||
withIdNull().builder.id("some-id") | ||
.projectBeneficiaryId("some-projectBeneficiary-id") | ||
.clientReferenceId("ClientReferenceId") | ||
.projectBeneficiaryClientReferenceId("projectBeneficiaryClientReferenceId") | ||
.reasons(new ArrayList<>(Arrays.asList("fever"))) | ||
.tenantId("some-tenant-id") | ||
.rowVersion(1); | ||
return this; | ||
} | ||
|
||
public ReferralTestBuilder withId(String id) { | ||
this.builder.id(id); | ||
return this; | ||
} | ||
|
||
public ReferralTestBuilder withBadTenantId() { | ||
this.builder.tenantId(null); | ||
return this; | ||
} | ||
|
||
public ReferralTestBuilder goodReferral() { | ||
this.builder.id("some-id") | ||
.projectBeneficiaryId("some-projectBeneficiary-id") | ||
.clientReferenceId("ClientReferenceId") | ||
.projectBeneficiaryClientReferenceId("projectBeneficiaryClientReferenceId") | ||
.reasons(new ArrayList<>(Arrays.asList("fever"))) | ||
.tenantId("some-tenant-id") | ||
.auditDetails(AuditDetailsTestBuilder.builder().withAuditDetails().build()) | ||
.clientAuditDetails(AuditDetailsTestBuilder.builder().withAuditDetails().build()); | ||
return this; | ||
} | ||
|
||
public ReferralTestBuilder withAuditDetails() { | ||
this.builder.auditDetails(AuditDetailsTestBuilder.builder().withAuditDetails().build()); | ||
return this; | ||
} | ||
|
||
public ReferralTestBuilder withDeleted() { | ||
this.builder.isDeleted(true); | ||
return this; | ||
} | ||
} |
Oops, something went wrong.