Fix asStringValue on IdType

This commit is contained in:
James Agnew 2023-05-23 17:02:23 -04:00
parent a7026ca51d
commit 0eca8d14ba
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(); return getValue();
} }
@Override
public String asStringValue() {
return getValue();
}
@Override @Override
public String getVersionIdPart() { public String getVersionIdPart() {
return myUnqualifiedVersionId; return myUnqualifiedVersionId;

View File

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

View File

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

View File

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

View File

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

View File

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