-
Notifications
You must be signed in to change notification settings - Fork 172
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
LUI-128 Add new Provider Attribute Type #91
Conversation
return datatype.deserialize(formFieldValue); | ||
} | ||
|
||
private boolean isInteger(String value) { | ||
return value.matches("-?\\d+"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a java library for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isNumeric() would be ok?
if (StringUtils.isNumeric(formFieldValue)) { | ||
BaseOpenmrsObject metadata = null; | ||
PropertyEditor editor; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some unit tests for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkayiwa Done :) I've managed to get 100% coverage
@Test | ||
public void getValue_givenLocationId_shouldCallDeserializeWithLocationUuid() throws Exception { | ||
List<Location> locations = Context.getLocationService().getAllLocations(); | ||
Location testedLocation = locations.get(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of getting all and then the first, why not just get for a particular id? You can pick them from here: https://github.com/openmrs/openmrs-core/blob/master/api/src/test/resources/org/openmrs/include/standardTestDataset.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkayiwa Done :)
Issue: https://issues.openmrs.org/browse/LUI-128