Merge pull request #133 from hapifhir/ks-20200212-meta-security
fixes a bug in Meta.getSecurity(String,String)
This commit is contained in:
commit
dcb1240e66
|
@ -277,7 +277,7 @@ public class Meta extends Type implements IBaseMetaType {
|
|||
* <code>null</code> if none
|
||||
*/
|
||||
public Coding getSecurity(String theSystem, String theCode) {
|
||||
for (Coding next : getTag()) {
|
||||
for (Coding next : getSecurity()) {
|
||||
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
|
||||
return next;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package org.hl7.fhir.dstu2.test;
|
||||
|
||||
import org.hl7.fhir.dstu2.model.Coding;
|
||||
import org.hl7.fhir.dstu2.model.Meta;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class MetaTest {
|
||||
public static String TEST_SYSTEM = "TEST_SYSTEM";
|
||||
public static String TEST_CODE = "TEST_CODE";
|
||||
|
||||
@Test
|
||||
public void testMetaSecurity() {
|
||||
Meta meta = new Meta();
|
||||
Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
|
||||
assertTrue(meta.hasSecurity());
|
||||
assertNotNull(meta.getSecurity());
|
||||
assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(1, meta.getSecurity().size());
|
||||
assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
}
|
||||
}
|
|
@ -421,7 +421,7 @@ public class Meta extends Type implements IBaseMetaType {
|
|||
* <code>null</code> if none
|
||||
*/
|
||||
public Coding getSecurity(String theSystem, String theCode) {
|
||||
for (Coding next : getTag()) {
|
||||
for (Coding next : getSecurity()) {
|
||||
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
|
||||
return next;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.hl7.fhir.dstu3.test;
|
||||
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
import org.hl7.fhir.dstu3.model.Meta;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class MetaTest {
|
||||
public static String TEST_SYSTEM = "TEST_SYSTEM";
|
||||
public static String TEST_CODE = "TEST_CODE";
|
||||
|
||||
@Test
|
||||
public void testMetaSecurity() {
|
||||
Meta meta = new Meta();
|
||||
Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
|
||||
assertTrue(meta.hasSecurity());
|
||||
assertNotNull(meta.getSecurity());
|
||||
assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(1, meta.getSecurity().size());
|
||||
assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
}
|
||||
}
|
||||
|
|
@ -476,7 +476,7 @@ public class Meta extends Type implements IBaseMetaType {
|
|||
* <code>null</code> if none
|
||||
*/
|
||||
public Coding getSecurity(String theSystem, String theCode) {
|
||||
for (Coding next : getTag()) {
|
||||
for (Coding next : getSecurity()) {
|
||||
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
|
||||
return next;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.hl7.fhir.r4.test;
|
||||
|
||||
import org.hl7.fhir.r4.model.Coding;
|
||||
import org.hl7.fhir.r4.model.Meta;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MetaTest {
|
||||
public static String TEST_SYSTEM = "TEST_SYSTEM";
|
||||
public static String TEST_CODE = "TEST_CODE";
|
||||
|
||||
@Test
|
||||
public void testMetaSecurity() {
|
||||
Meta meta = new Meta();
|
||||
Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
|
||||
assertTrue(meta.hasSecurity());
|
||||
assertNotNull(meta.getSecurity());
|
||||
assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(1, meta.getSecurity().size());
|
||||
assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
package org.hl7.fhir.r5.test;
|
||||
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.Meta;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MetaTest {
|
||||
public static String TEST_SYSTEM = "TEST_SYSTEM";
|
||||
public static String TEST_CODE = "TEST_CODE";
|
||||
|
||||
@Test
|
||||
public void testMetaSecurity() {
|
||||
Meta meta = new Meta();
|
||||
Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
|
||||
assertTrue(meta.hasSecurity());
|
||||
assertNotNull(meta.getSecurity());
|
||||
assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(1, meta.getSecurity().size());
|
||||
assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue