Skip to content

Commit

Permalink
clean up DAR other conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
rushtong committed Dec 6, 2023
1 parent ccf2991 commit cbdfad8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,13 @@ public DataUse parseDataUsePurpose(DataAccessRequest dar) {
}

// Other Conditions
if (Objects.nonNull(dar.getData().getOther())) {
dataUse.setOtherRestrictions(dar.getData().getOther());
}
if (Objects.nonNull(dar.getData().getOtherText())) {
if (Objects.nonNull(dar.getData().getOther())
&& Boolean.TRUE.equals(dar.getData().getOther())
&& Objects.nonNull(dar.getData().getOtherText())) {
dataUse.setOtherRestrictions(true);
dataUse.setOther(dar.getData().getOtherText());
}

// if (Objects.nonNull(dar.getData().getNotHealth())) {
// dataUse.setNotHealth(dar.getData().getNotHealth());
// dataUse.setNonBiomedical(dar.getData().getNotHealth());
// }

if ((Objects.nonNull(dar.getData().getIllegalBehavior())) && Boolean.TRUE.equals(dar.getData()
.getIllegalBehavior())) {
dataUse.setIllegalBehavior(dar.getData().getIllegalBehavior());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,25 +283,16 @@ void testParseDataUsePurposeHMB() {
}

@Test
void testParseDataUsePurposeOther1() {
void testParseDataUsePurposeOther() {
Client client = ClientBuilder.newClient();
UseRestrictionConverter converter = new UseRestrictionConverter(client, config());
DataAccessRequest dar = createDataAccessRequest();
dar.getData().setOther(true);
dar.getData().setOtherText("Other Text");
DataUse dataUse = converter.parseDataUsePurpose(dar);
assertTrue(dataUse.getOtherRestrictions());
}

@Test
void testParseDataUsePurposeOther2() {
Client client = ClientBuilder.newClient();
UseRestrictionConverter converter = new UseRestrictionConverter(client, config());
DataAccessRequest dar = createDataAccessRequest();
dar.getData().setOtherText("other");
DataUse dataUse = converter.parseDataUsePurpose(dar);
assertNotNull(dataUse.getOther());
}

@Test
void testParseDataUseIllegalBehavior() {
Client client = ClientBuilder.newClient();
Expand Down

0 comments on commit cbdfad8

Please sign in to comment.