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

TRUNK-5382 add extra utility method to exclude retired concepts #2654

Closed
wants to merge 1 commit into from

Conversation

saidrobley
Copy link

@saidrobley saidrobley commented Apr 11, 2018

TRUNK-5382 Extra utility method for excluding retired concepts while fetching setmembers

Description of what I changed

Created utility method called getSetMembers(boolean includeRetired). If includeRetired is true it returns the same as getSetMembers(), if false it should return excluding retired members.

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-5382

Checklist: I completed these to help reviewers :)

  • [x ] My pull request only contains ONE single commit
    (the number above, next to the 'Commits' tab is 1).

  • [x ] My IDE is configured to follow the code style of this project.

  • [ x] I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

  • [x ] I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

  • [x ] All new and existing tests passed.

  • [ x] My pull request is based on the latest changes of the master branch.

@coveralls
Copy link

coveralls commented Apr 11, 2018

Coverage Status

Coverage increased (+0.02%) to 59.117% when pulling 828c822 on saidrobley:TRUNK-5382 into 4d5fd90 on openmrs:master.

@Ben-Waters
Copy link
Contributor

Would be good if the commit message referenced the Jira.
"TRUNK-5382 YOUR MESSAGE HERE"


List<Concept> setMembers = c.getSetMembers(true);

Assert.assertEquals(4, setMembers.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that those four Concepts are a mix of retired and unretired Objects?
You should prove that this setMembers contain the unretired concepts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert.assertEquals(2, c.getSetMembers(false).size());
this will exclude the retired concepts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, what I am saying is you are trying to verify your implementation. So you should prove this before using another method.
i.e : let's count the retired and unretired concepts from setMembers and prove, it contains both.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert.assertFalse(setMembers.get(0).getRetired()); // not retired
Assert.assertFalse(setMembers.get(1).getRetired()); // not retired
Assert.assertTrue(setMembers.get(2).getRetired()); // retired
Assert.assertTrue(setMembers.get(3).getRetired()); // retired


List<Concept> setMembers = c.getSetMembers(false);

Assert.assertEquals(2, setMembers.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can you confirm that these two objects are unretired objects and no more retired objects in this list?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setMembers.forEach(member -> Assert.assertEquals(true, !member.getRetired()));
this will go through each member and check if they are not retired

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the changes requested, let me know if there are other changes

@saidrobley saidrobley changed the title add extra utility method to exclude retired concepts TRUNK-5383 add extra utility method to exclude retired concepts Apr 14, 2018
@saidrobley saidrobley changed the title TRUNK-5383 add extra utility method to exclude retired concepts TRUNK-5382 add extra utility method to exclude retired concepts Apr 14, 2018
@saidrobley saidrobley force-pushed the TRUNK-5382 branch 2 times, most recently from 9b6646b to c828950 Compare April 14, 2018 21:37
@suthagar23
Copy link
Member

Have you thought of coveralls failure?

@saidrobley
Copy link
Author

I have fixed that failure

@@ -1556,6 +1556,25 @@ public void setId(Integer id) {
}
return Collections.unmodifiableList(conceptMembers);
}

/**
* If <code>includeRetired</code> is true, then the returned object is the actual stored list of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can please clean up the javadocs? The second phrase is probably unnecessary, the javadocs need to mention what the method does, i.e. returns set members and includes retired ones if includeRetired is set to true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saidrobley did you see the above comment?

/**
* When asked for a collection of compatible names, the returned collection should not include
* any incompatible names.
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert these auto format changes? Did you format your code?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@saidrobley saidrobley force-pushed the TRUNK-5382 branch 2 times, most recently from 361bd3b to 399cd5f Compare April 25, 2018 02:51
remove comments

revert auto format changes

revert auto format changes
@dkayiwa
Copy link
Member

dkayiwa commented Jul 12, 2018

@saidrobley did you see @wluyima's comment?

@dkayiwa
Copy link
Member

dkayiwa commented Jul 17, 2018

@saidrobley are you still working on this?

@saidrobley
Copy link
Author

@dkayiwa yes, I have made all the changes requested

* @return List&lt;Concept&gt; the Concepts that are members of this Concept's set
* @should return set members and includes retired ones if includeRetired is set to true
* @should not return retired members if includeRetired is false
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a since annotation to indicate the openmrs version when this method is introduced?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, it's included at line 1563

@dkayiwa
Copy link
Member

dkayiwa commented Oct 18, 2018

@saidrobley did you see the above comments?

@saidrobley
Copy link
Author

@dkayiwa since annotation to indicate the openmrs version is at line 1563

@dkayiwa
Copy link
Member

dkayiwa commented Nov 20, 2018

Closing because the author is no longer working on it.

@dkayiwa dkayiwa closed this Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants