Merge branch 'master' into gg-202105-version-conversion-1

This commit is contained in:
Grahame Grieve 2021-05-05 14:10:12 +10:00 committed by GitHub
commit c56b7b67c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 140 additions and 94 deletions

17
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# Six months, minus 5 days, inactivity before an issue becomes stale
daysUntilStale: 175
# 5 days of inactivity before a stale issue is closed
daysUntilClose: 5
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 5 days if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@ -3,3 +3,4 @@
* Snapshot generator: fix problem checking types on logical models
* Do not flag internal references as suspicious
* XMLParser allows passing a schema location
* Issue 484 https://github.com/hapifhir/org.hl7.fhir.core/issues/484

View File

@ -30,10 +30,8 @@ package org.hl7.fhir.r5.model;
*/
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
/**
* Primitive type "integer" in FHIR: A signed 32-bit integer
@ -57,13 +55,18 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
setValue(theInteger);
}
/**
* Constructor
*/
public IntegerType(Integer theInteger) {
setValue(theInteger);
}
/**
* Constructor
*
* @param theIntegerAsString
* A string representation of an integer
* @throws IllegalArgumentException
* If the string is not a valid integer representation
* @param theIntegerAsString A string representation of an integer
* @throws IllegalArgumentException If the string is not a valid integer representation
*/
public IntegerType(String theIntegerAsString) {
setValueAsString(theIntegerAsString);
@ -80,8 +83,8 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
throw new IllegalArgumentException
(theValue + " cannot be cast to int without changing its value.");
}
if(theValue!=null) {
setValue((int)theValue.longValue());
if (theValue != null) {
setValue((int) theValue.longValue());
}
}
@ -101,6 +104,7 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
@Override
public IntegerType copy() {
// IntegerType ret = getValue() == null ? new IntegerType() : new IntegerType(getValue());
IntegerType ret = new IntegerType(getValue());
copyValues(ret);
return ret;

View File

@ -0,0 +1,24 @@
package org.hl7.fhir.r5.model;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
class IntegerTypeTest {
@Test
@DisplayName("Test that non-initialized Integer value doesn't cause crash on copy()")
public void testNullIntegerType() {
IntegerType intType = new IntegerType();
IntegerType intType2 = intType.copy();
Assertions.assertNull(intType2.getValue());
}
@Test
@DisplayName("Test that initialized with null Integer value doesn't cause crash on copy()")
public void testNullIntegerTypeString() {
IntegerType intType = new IntegerType((String) null);
IntegerType intType2 = intType.copy();
Assertions.assertNull(intType2.getValue());
}
}