Merge pull request #1274 from hapifhir/ja_20230523_1262_fix_asstringvalue

Fix asStringValue on IdType
This commit is contained in:
Grahame Grieve 2023-05-24 10:37:28 +10:00 committed by GitHub
commit e724c9d58b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 55 additions and 0 deletions

View File

@ -409,6 +409,11 @@ public final class IdType extends UriType implements IPrimitiveType<String>, IId
return getValue();
}
@Override
public String asStringValue() {
return getValue();
}
@Override
public String getVersionIdPart() {
return myUnqualifiedVersionId;

View File

@ -387,6 +387,11 @@ public final class IdType extends UriType implements IPrimitiveType<String>, IId
return getValue();
}
@Override
public String asStringValue() {
return getValue();
}
@Override
public String getVersionIdPart() {
return myUnqualifiedVersionId;

View File

@ -384,6 +384,11 @@ public final class IdType extends UriType implements IPrimitiveType<String>, IId
return getValue();
}
@Override
public String asStringValue() {
return getValue();
}
@Override
public String getVersionIdPart() {
return myUnqualifiedVersionId;

View File

@ -495,6 +495,11 @@ public final class IdType extends UriType implements IPrimitiveType<String>, IId
return getValue();
}
@Override
public String asStringValue() {
return getValue();
}
/**
* Set the value
* <p>

View File

@ -493,6 +493,11 @@ public final class IdType extends UriType implements IPrimitiveType<String>, IId
return getValue();
}
@Override
public String asStringValue() {
return getValue();
}
/**
* Set the value
* <p>

View File

@ -493,6 +493,11 @@ public final class IdType extends UriType implements IPrimitiveType<String>, IId
return getValue();
}
@Override
public String asStringValue() {
return getValue();
}
/**
* Set the value
* <p>

View File

@ -0,0 +1,25 @@
package org.hl7.fhir.r5.model;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class IdTypeTest {
@Test
public void testAsString() {
IdType t = new IdType("Patient/123");
assertEquals("Patient/123", t.asStringValue());
assertEquals("Patient/123", t.getValueAsString());
assertEquals("Patient/123", t.getValue());
}
@Test
public void testAsStringFromComponentParts() {
IdType t = new IdType("http://foo", "Patient", "123", "1");
assertEquals("http://foo/Patient/123/_history/1", t.asStringValue());
assertEquals("http://foo/Patient/123/_history/1", t.getValueAsString());
assertEquals("http://foo/Patient/123/_history/1", t.getValue());
}
}